Common.h
上传用户:guangzhiyw
上传日期:2007-01-09
资源大小:495k
文件大小:4k
源码类别:

ICQ/即时通讯

开发平台:

Visual C++

  1. #ifndef _COMMON_HEADER
  2. #define _COMMON_HEADER
  3. #define ResponseMsg "ok"
  4. #define SETUPFILE "config.ini"
  5. #define DEFAULT_SEND_NUM  5
  6. #define DEFAULT_DATAS_PWD ""
  7. #define DEFAULT_DSN    "IDServer"  
  8. #define DEFAULT_UID  ""
  9. #define DEFAULT_BROADCAST_PWD "1234567890"
  10. #define DEFAULT_RECV_PORT_STR "4000,4001,4002"
  11. const int ListenSocketNum=10;
  12. const int SendSocketNum=15;
  13. const int TimeWaitForRes=6000;
  14. const int MaxUserNumber=500;
  15. const int UserIdRadix=2000;
  16. const int PersonNumEveryTime=20;
  17. const int TimerSpanServer=30000;
  18. const int TimerSpanClient=40000;
  19. const int DataBufLength=1000;
  20. const int MaxResponseMsgLength=20;
  21. const int CheckBufLength=512;
  22. typedef struct{
  23. BYTE State;  //0 offline,1 online,2 onhide
  24. BYTE CanbeAdd;
  25. DWORD Id;
  26. DWORD IP;
  27. DWORD Port;
  28. DWORD PhotoId;
  29. CString Name;
  30. CString Department;
  31. }UserOnline;
  32. UINT ProcessRecvData(LPVOID param);
  33. UINT CheckOnline(LPVOID param);
  34. //--------------------------- Server Receive ------------------------------------------------
  35. //--------------------------- Client Send To Server------------------------------------------
  36. #define SEND_MSG_TO_FRIEND       1   //CMsg1 index,friendId,myId,msg,time  
  37. #define FRIEND_IDENTITY_VALIDATE 2   //CMsg1
  38. #define ADD_AS_FRIEND            3   //CMsg1 
  39. #define FRIEND_DETAIL            4   //CMsg1 
  40. #define FIND_FRIEND_BY_ID        5   //CMsg1 
  41. #define DELETE_A_FRIEND          6   //CMsg1 
  42. #define DELETE_SELF_IN_FRIEND    7   //CMsg1  选择在某人的好友中删除自己
  43. #define ACCEPT_AS_FRIEND         8   //CMsg1  响应加为好友请求反馈信息(属于系统消息)
  44. #define REFUSE_AS_FRIEND         9   //CMsg1  响应加为好友请求反馈信息(属于系统消息)
  45. #define ONLINE                  10   //CData index,myid 
  46. #define ONHIDE                  11   //CData index,myid 
  47. #define OFFLINE                 12   //CData index,myid 
  48. #define MULTI_SEND_MSG          13   //CMsg2 index,myid,friendidarray,msg,time  
  49. #define APPLY_SHOW_ONLINE       14   //CMsg3  index,myid,value 请求查看在线的人 
  50. #define TEST_BROADCAST_PWD      15   //CMsg4 index,id,broadcastpwd,msg  
  51. #define SEND_BROADCAST          16   //CMsg4 
  52. #define FIND_FRIEND_BY_NAME     17   //CMsg4 index,myid,name(msg)
  53. #define CHANGE_PERSONAL_INFO    18   //CMsgModifyPI index,myid,mask,name,address,phone,fax,email,homepage,photoid,canbeadd,department,sex,age,description
  54. #define CHANGE_PASSWORD         19   //CMsgModifyPwd index,myid,oldpwd,newpwd 
  55. #define HAVE_ID_LOGIN           20   //CMsgModifyPwd index,id,pwd(oldpwd) 
  56. #define APPLY_ID_LOGIN          21   //CMsgPerson index,name,address,phone,fax,email,homepage,photoid,canbeadd,department,sex,age,pwd,description
  57. //-------------------------------- Server Send To Client -------------------------------------------
  58. //-------------------------------- Client Recv From Server -----------------------------------------
  59. #define RE_ADD_AS_FRIEND         31   //CMsg3 index,myid,value(0,1,2,3)(别人拒绝,成功加入,要求验证人份,此人已经为好友)
  60. #define RE_TEST_BROADCAST_PWD    32   //CMsg3 index,myid,value (0,1) 密码错误,密码正确 
  61. #define TOTAL_ONLINE             33   //CMsg3 index,myId,Value 响应发送的总在线人数信息 
  62. #define RE_LOGIN_INFO            34   //CMsg3 index,myid,value (0,1,2) 帐号不存在,密码错误,OK 
  63. #define RECV_SHOW_ONLINE         35   //CShowOnlinePeople
  64. #define FOUND_FRIEND_BY_NAME     36   //CShowOnlinePeople
  65. #define APPLY_ID_OK              37   //CData index,myid(收到这个信息,这表示登陆成功)
  66. #define ID_NOT_FOUND_BY_ID       38   //CData
  67. #define NAME_NOT_FOUND_BY_NAME   39   //CData
  68. #define REQUIRE_IDENTITY_VALIDATE 40  //CData 
  69. #define ONHIDE_OK                41
  70. #define ONLINE_OK                52
  71. #define FOUND_FRIEND_BY_ID       43   //CMsgPerson 
  72. #define RE_FRIEND_DETAIL         44   //CMsgPerson
  73. #define ALL_FRIEND_ID            45   //CMsg2 index,id,friendidarray(收到这个信息,这表示登陆成功)
  74. #define ONLINE_FRIEND            46   //CMsgOnlineFriend index,id,aFriendid,aFriendstate,aFriendIP,aFriendPort
  75. #define BE_ADDED_AS_FRIEND       47   //CMsg1 响应好友加入的消息
  76. #define SYSTEM_BROADCAST         48   //CMsg1
  77. #define SOMEONE_ONLINE           49
  78. #define SOMEONE_ONHIDE           50
  79. #define SOMEONE_OFFLINE          51
  80. //----------------------------------Client To Client-----------------------------------------------
  81. //SEND_MSG_TO_FRIEND
  82. //FRIEND_IDENTITY_VALIDATE
  83. #endif