SV_JY.H
上传用户:bjghjy
上传日期:2007-01-07
资源大小:379k
文件大小:7k
- // define udp pack head
- #define JY_CHKUSR_HEAD (LPSTR)"JYCHKUSR"
- #define JY_CHGPWD_HEAD (LPSTR)"JYCHGPWD"
- #define JY_BUYSELL_HEAD (LPSTR)"JYBUYSELL"
- #define JY_SELL_HEAD (LPSTR)"JYSELL"
- #define JY_CANCEL_HEAD (LPSTR)"JYCANCEL"
- #define JY_YECX_HEAD (LPSTR)"JYYECX"
- #define JY_CJCX_HEAD (LPSTR)"JYCJCX"
- #define JY_WTCX_HEAD (LPSTR)"JYWTCX"
- #define JY_CXEND_HEAD (LPSTR)"JYCXEND"
- #define JY_TIMEOUT_HEAD (LPSTR)"JYTIMEOUT"
- #define MAX_GDDM_SIZE 10
- #define MAX_JYMM_SIZE 6
- #define MAX_RQ_SIZE 6
- #define MAX_GPDM_SIZE 6
- #define MAX_HTHM_SIZE 6
- #define MAX_TIME_SIZE 6
- #define MAX_CANCEL_SENDCOUNT 10
- #define MAX_CX_SENDCOUNT 20
- // define udp request and answer pack structure
- typedef struct tag_PACK_ASK_CHKUSR
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- char jymm[MAX_JYMM_SIZE+1]; //
- }JY_ASK_CHKUSR, FAR *LPJY_ASK_CHKUSR;
- typedef struct tag_PACK_ANS_CHKUSR
- {
- char flag; //if 0,right,if -1 ,then user invalid
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- }JY_ANS_CHKUSR, FAR *LPJY_ANS_CHKUSR;
- typedef struct tag_PACK_ASK_CHGPWD
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- char xmm[MAX_JYMM_SIZE+1]; //
- }JY_ASK_CHGPWD, FAR *LPJY_ASK_CHGPWD;
- typedef struct tag_PACK_ANS_CHGPWD
- {
- char flag; // if 0 succeed,if -1 then failed
- char jys; //
- char gddm[MAX_GDDM_SIZE+1]; //
- }JY_ANS_CHGPWD, FAR *LPJY_ANS_CHGPWD;
-
- typedef struct tag_PACK_ASK_BUYSELL
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- char gpdm[MAX_GPDM_SIZE+1]; //
- char bs; // 'B', 'S'
- int wtgs;
- int wtjg;
- }JY_ASK_BUYSELL, FAR *LPJY_ASK_BUYSELL;
- typedef struct tag_PACK_ANS_BUYSELL
- {
- char flag; //0 succeed,-1 no money,-2 no stock
- char jys; //
- char gddm[MAX_GDDM_SIZE+1]; //
- char hthm[MAX_HTHM_SIZE+1]; //
- char bs;
- }JY_ANS_BUYSELL, FAR *LPJY_ANS_BUYSELL;
- typedef struct tag_CANCEL
- {
- char hthm[MAX_HTHM_SIZE+1];
- }CANCEL, FAR *LPCANCEL;
- typedef struct tag_PACK_ASK_CANCEL
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- short cancelCount;
- CANCEL Cancel[MAX_CANCEL_SENDCOUNT]; //
- }JY_ASK_CANCEL, FAR *LPJY_ASK_CANCEL;
- typedef struct tag_PACK_ANS_CANCEL
- {
- char flag[MAX_CANCEL_SENDCOUNT]; //
- char jys; //
- char gddm[MAX_GDDM_SIZE+1]; //
- }JY_ANS_CANCEL, FAR *LPJY_ANS_CANCEL;
- typedef struct tag_PACK_ASK_YECX
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- char gpdm[MAX_GPDM_SIZE+1]; //
- }JY_ASK_YECX, FAR *LPJY_ASK_YECX;
- typedef struct tag_GPTG
- {
- char gpdm[MAX_GPDM_SIZE+1]; //
- char kys[9+1],gpye[9+1]; //
- char ghrq[MAX_RQ_SIZE+1]; //
- }JY_GPTG, FAR *LPJY_GPTG;
- typedef struct tag_PACK_ANS_YECX
- {
- char flag;
- char jys; //
- char gddm[MAX_GDDM_SIZE+1]; //
- short recnum; //
- double kys,zjye;
- LPJY_GPTG lpGptg;
- }JY_ANS_YECX, FAR *LPJY_ANS_YECX;
- typedef struct tag_PACK_ASK_CJCX
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- char cjrq[MAX_RQ_SIZE+1]; //YYMMDD
- char hthm[MAX_HTHM_SIZE+1]; // IF HTHM IS EMPTY,THEN RUQER ALL CJ
- }JY_ASK_CJCX, FAR *LPJY_ASK_CJCX;
- typedef struct tag_CJ
- {
- char hthm[MAX_HTHM_SIZE+1]; //
- char cjsj[MAX_TIME_SIZE+1]; //HHMISS
- char mmbz; //B,S
- char gpdm[MAX_GPDM_SIZE+1];
- char cjgs[8+1];
- char cjjg[7+1];
- }JY_CJ, FAR *LPJY_CJ;
- typedef struct tag_PACK_ANS_CJCX
- {
- char flag;
- char jys; //
- char gddm[MAX_GDDM_SIZE+1]; //
- short recnum;
- char cjrq[MAX_RQ_SIZE+1]; //YYMMDD
- LPJY_CJ lpCj;
- }JY_ANS_CJCX, FAR *LPJY_ANS_CJCX;
- typedef struct tag_PACK_ASK_WTCX
- {
- char jys; //
- int userId;
- char gddm[MAX_GDDM_SIZE+1]; //
- char wtrq[MAX_RQ_SIZE+1]; //YYMMDD
- char hthm[MAX_HTHM_SIZE+1]; // IF HTHM IS EMPTY,THEN RUQER ALL WT
- }JY_ASK_WTCX, FAR *LPJY_ASK_WTCX;
- typedef struct tag_WT
- {
- char hthm[MAX_HTHM_SIZE+1]; //
- char wtsj[MAX_TIME_SIZE+1]; //HHMISS
- char mmbz; //B,S
- char gpdm[MAX_GPDM_SIZE+1];
- char wtgs[8+1]; //if wtgs<0 then is cancel
- char wtjg[7+1];
- }JY_WT, FAR *LPJY_WT;
- typedef struct tag_PACK_ANS_WTCX
- {
- char flag;
- char jys; //
- char gddm[MAX_GDDM_SIZE+1]; //
- short recnum;
- char wtrq[MAX_RQ_SIZE+1]; //YYMMDD
- LPJY_WT lpWt;
- }JY_ANS_WTCX, FAR *LPJY_ANS_WTCX;
-
- #define JY_CHKUSR 0
- #define JY_CHGPWD 1
- #define JY_BUYSELL 2
- #define JY_CANCEL 3
- #define JY_YECX 4
- #define JY_CJCX 5
- #define JY_WTCX 6
- // defeine comm dbf file
- #define fld_ASKNO 0
- #define fld_ANSNO 1
- #define fld_STKNO 2
- #define fld_GDDM 3
- #define fld_JYMM 4
- #define fld_GPDM 5
- #define fld_WTGS 6
- #define fld_WTJG 7
- #define fld_HTHM 8
- #define fld_DATE 9
- #define fld_STAT 10
- #define REQ_NULL '0'
- #define REQ_CHKUSR '1'
- #define REQ_CHGPWD '2'
- #define REQ_BUY '3'
- #define REQ_SELL '4'
- #define REQ_BUYSEL '3'
- #define REQ_CANCEL '5'
- #define REQ_YECX '6'
- #define REQ_CJCX '7'
- #define REQ_WTCX '8'
- #define REQ_EXIT '9'
- #define ANS_SUCC '0'
- #define ANS_NO_MONEY '1'
- #define ANS_NO_STOCK '2'
- #define ANS_NOT_FOUND '3'
- #define ANS_TIME_OUT '4'
- #define ANS_SYS_ERR '5'
- #define ANS_NO_PRIV '6'
- #define ANS_NO_GDDM '7'
- #define ANS_NO_CANCEL '8'
- #define ANS_GDDM_USE 'I'
- #define MAX_WAIT_TIME 20
- int JyInit(void);
- int JyExit(void);
- int Jy_ChkUsr(int sd, struct sockaddr *, int, LPJY_ASK_CHKUSR);
- int Jy_ChgPwd(int sd, struct sockaddr *, int, LPJY_ASK_CHGPWD);
- int Jy_BuySell(int sd, struct sockaddr *, int, LPJY_ASK_BUYSELL);
- int Jy_Cancel(int sd, struct sockaddr *, int, LPJY_ASK_CANCEL);
- int Jy_Yecx(int sd, struct sockaddr *, int, LPJY_ASK_YECX);
- int Jy_Cjcx(int sd, struct sockaddr *, int, LPJY_ASK_CJCX);
- int Jy_Wtcx(int sd, struct sockaddr *, int, LPJY_ASK_WTCX);