資源描述:
《socket聊天程序api接口》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、Socket聊天程序API接口typedefunsignedintuint32t;typedefunsignedshortuint16t;typedefunsignedcharuint8t;#defineQF_Register0x1#defineQF_Login0x2#defineQF_ModifyUser0x3#defineQF_ModifyDynamicUser0x4#defineQF_Logout0x5#defineQF_UploadHeadImage0x6#defineQF_DownloadHeadImage0x7#defineQF_Delet
2、eHeadImage0x8#defineQF_HeartBeat0x9#defineQF_Profile0x10#defineQF_SaveOfflineMsg0x12#defineQF_ReadOfflineMsg0x13/**Socket聊天程序API接口*//*請(qǐng)求頭的通用類型*/structQFChatRequestProtocol{uint32ttype;/*協(xié)議類型*/uint32tsubType;/*協(xié)議子類型*/uint32tpayloadLength;/*協(xié)議內(nèi)容長(zhǎng)度*/uint32treserverd;/*保留字段*/};/*響應(yīng)頭
3、的通用類型*/structQFChatResponseProtocol{uint32tpayloadLength;/*協(xié)議內(nèi)容長(zhǎng)度*/uint32tstatus;charmsg[128];};/**用戶靜態(tài)信息:*/structQFUserInfo{uint32tuserID;/*用戶在服務(wù)器數(shù)據(jù)庫(kù)上存放的ID*/charusername[32];/*用戶名;用戶名不能修改*/charpassword[32];/*密碼*/charnickname[128];/*昵稱*/charqmd[128];/*用戶的簽名檔*/};/**用戶動(dòng)態(tài)信息:*/#defi
4、neQFUSER_INFO_STATUS(1<<1)#defineQFUSER_INFO_LAN(1<<2)#defineQFUSER_INFO_WAN(1<<3)#defineQFUSER_INFO_GPS(1<<4)structQFDynamicUserInfo{uint32tuserID;uint32ttype;/*后續(xù)包含的內(nèi)容有什么,*//*比如有status;有局域網(wǎng)地址,有廣域網(wǎng)地址,有g(shù)ps*//*用戶的狀態(tài)*//*0Online;1Away;2Hidden;*/uint32tstatus;charlanIP[16];/*局域網(wǎng)的ip地
5、址*/charwanIP[16];/*外網(wǎng)的ip地址*/uint16tlanPort;/*局域網(wǎng)的端口*/uint16twanPort;/*外網(wǎng)的端口*/floatgpsLatitude;floatgpsLongitude;};/*1.注冊(cè)Register*/structQFRegisterRequest{structQFChatRequestProtocolheader;structQFUserInfouser;/*里面的userID無(wú)效*/};/**成功后返回status>=0;*/structQFRegisterResponse{structQF
6、ChatResponseProtocolresponse;};/*status>=0成功返回status<0錯(cuò)誤錯(cuò)誤信息放在msg中*//*2.登陸Login*/structQFLoginRequest{structQFChatRequestProtocolheader;charusername[32];/*用戶名*/charpassword[32];/*密碼*/charlanIP[32];/*局域網(wǎng)的ip地址*/charlanPort[32];/*局域網(wǎng)的端口*/floatgpsLatitude;floatgpsLongitude;};/*成功后返回
7、*/structQFLoginResponse{structQFChatResponseProtocolresponse;uint32userID;};/**3.修改用戶信息ModifyUser*/structQFModifyUserRequest{structQFChatRequestProtocolheader;structQFUserInfouser;};/*成功返回*/structQFModifyUserResponse{structQFChatResponseProtocolresponse;structQFUserInfouser;};/*
8、*3.修改用戶動(dòng)態(tài)信息ModifyDynamicUser*/structQFModifyDyn