-
Notifications
You must be signed in to change notification settings - Fork 0
/
smsbbsprotocoldefine.h
130 lines (106 loc) · 3.95 KB
/
smsbbsprotocoldefine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef SMS_BBS_6DA06848BE2D41f29E8FA85F83CB5AD7
#define SMS_BBS_6DA06848BE2D41f29E8FA85F83CB5AD7
namespace SMS{
typedef struct _SMS_BBS_HEADER{ //
byte Type;
byte SerialNo[4];
byte pid[4];
byte msgLength[4]; //总Packet长度
} SMS_BBS_HEADER, *PSMS_BBS_HEADER;
//返回值
#define SMS_BBS_CMD_LOGIN 1
#define SMS_BBS_CMD_OK 101
#define SMS_BBS_CMD_ERR 102
#define SMS_BBS_CMD_HEAD_LENGTH_ERR 103 //包头错误
#define SMS_BBS_CMD_DB_ERROR 104 //数据库操作错误
#define SMS_BBS_CMD_SMS_VALIDATE_FAILED 105 //短信无法通过发送检查
#define SMS_BBS_CMD_LENGTH_ERR 106 //消息包长度错误
#define SMS_BBS_CMD_NO_VALIDCODE 107 //无认证码供验证
#define SMS_BBS_CMD_NO_SUCHMOBILE 108 //取消认证码时发现此手机未认证
#define SMS_BBS_CMD_REGISTERED 109 //手机号码和id已绑定
#define SMS_BBS_CMD_EXCEEDMONEY_LIMIT 110 //用户当日额度已满
#define SMS_BBS_CMD_LOGOUT 2
#define SMS_BBS_CMD_REG 3
#define SMS_BBS_CMD_CHECK 4
#define SMS_BBS_CMD_UNREG 5
#define SMS_BBS_CMD_REQUEST 6
#define SMS_BBS_CMD_REQUESTREPLY 7
#define SMS_BBS_CMD_BBSSEND 8
#define SMS_BBS_CMD_GWSEND 9
#define SMS_BBS_CMD_REQUIRE_MONEYLIMIT 10
#define SMS_BBS_CMD_MONEYLIMIT 11
#define SMS_BBS_CMD_LINK 20
#define SMS_BBS_USER_LEN 19
#define SMS_BBS_PASS_LEN 49
#define SMS_BBS_VALID_LEN 6 //认证码长度
#define SMS_BBS_TYPE_LEN 0 //短信类型长度
#define SMS_BBS_MAX_COMMAND_SMS_LEN 200 //控制短信最大长度
#define SMS_BBS_USR_REQUIRE_BIND 0
#define SMS_BBS_USR_REQUIRE_UNBIND 1
//短消息类型代码
#define SMS_BBS_TYPE_COMMON 0 //普通短信
#define SMS_BBS_TYPE_COMMAND 1 //用户操作短信
#define SMS_BBS_TYPE_NONE -1
//消息类型
#define SMS_BBS_ID_LEN 13
typedef struct _SMS_BBS_LOGINPACKET { //BBS连接请求
SMS_BBS_HEADER header;
char user[SMS_BBS_USER_LEN+1];
char password[SMS_BBS_PASS_LEN+1];
} SMS_BBS_LOGINPACKET, *PSMS_BBS_LOGINPACKET;
typedef struct _SMS_BBS_REGISTERMOBILEPACKET { //BBS请求网关发送手机绑定短信
SMS_BBS_HEADER header;
char MobileNo[MOBILENUMBERLENGTH+1];
char cUserID[SMS_BBS_ID_LEN+1];
} SMS_BBS_REGISTERMOBILEPACKET,*PSMS_BBS_REGISTERMOBILEPACKET;
typedef struct _SMS_BBS_REGISTERVALIDATIONPACKET { //BBS请求网关检查手机绑定码
SMS_BBS_HEADER header;
char MobileNo[MOBILENUMBERLENGTH+1];
char cUserID[SMS_BBS_ID_LEN+1];
char ValidateNo[SMS_BBS_VALID_LEN+1];
} SMS_BBS_REGISTERVALIDATIONPACKET, *PSMS_BBS_REGISTERVALIDATIONPACKET;
typedef struct _SMS_BBS_UNREGISTERMOBILEPACKET { //BBS请求网关取消手机绑定
SMS_BBS_HEADER header;
char MobileNo[MOBILENUMBERLENGTH+1];
char cUserID[SMS_BBS_ID_LEN+1];
}SMS_BBS_UNREGISTERMOBILEPACKET, *PSMS_BBS_UNREGISTERMOBILEPACKET;
typedef struct _SMS_BBS_BINDREQUESTPACKET { //网关要求BBS绑定手机号码
SMS_BBS_HEADER header;
char cUserID[SMS_BBS_ID_LEN+1];
char MobileNo[MOBILENUMBERLENGTH+1];
byte Bind;
}SMS_BBS_BINDREQUESTPACKET, *PSMS_BBS_BINDREQUESTPACKET;
typedef struct _SMS_BBS_BINDREQUESTREPLYPACKET { //Type=7
SMS_BBS_HEADER header;
char MobileNo[MOBILENUMBERLENGTH+1];
byte isSucceed;
}SMS_BBS_BINDREQUESTREPLYPACKET, *PSMS_BBS_BINDREQUESTREPLYPACKET;
typedef struct _SMS_BBS_BBSSENDSMS { //Type=8
SMS_BBS_HEADER header;
byte UserID[4];
char SrcMobileNo[MOBILENUMBERLENGTH+1];
char srcUserID[SMS_BBS_ID_LEN+1];
char DstMobileNo[MOBILENUMBERLENGTH+1];
byte MsgTxtLen[4];
char MsgTxt[0];
}SMS_BBS_BBSSENDSMS,*PSMS_BBS_BBSSENDSMS;
typedef struct _SMS_BBS_GWSENDSMS { //Type=9
SMS_BBS_HEADER header;
byte UserID[4];
char SrcMobileNo[MOBILENUMBERLENGTH+1];
byte MsgTxtLen[4];
char MsgTxt[0];
}SMS_BBS_GWSENDSMS, *PSMS_BBS_GWSENDSMS;
inline unsigned long int sms_byteToLong(byte arg[4]) {
long tmp;
tmp=(arg[0]<<24)+(arg[1]<<16)+(arg[2]<<8)+arg[3];
return tmp;
}
inline void sms_longToByte(byte* arg, DWORD num) {
arg[0]=num>>24;
arg[1]=(num>>16) & 0xff;
arg[2]=(num>>8) & 0xff;
arg[3]=num & 0xff;
}
}
#endif