22 lines
435 B
C
22 lines
435 B
C
|
// protocol.h
|
||
|
#ifndef PROTOCOL_H
|
||
|
#define PROTOCOL_H
|
||
|
|
||
|
#define MSG_REGISTER 1
|
||
|
#define MSG_LOGIN 2
|
||
|
#define MSG_ADD_FRIEND 3
|
||
|
#define MSG_PRIVATE_CHAT 4
|
||
|
#define MSG_OK 100
|
||
|
#define MSG_FAIL 101
|
||
|
|
||
|
#define MAX_NAME_LEN 32
|
||
|
#define MAX_MSG_LEN 256
|
||
|
|
||
|
typedef struct {
|
||
|
int type; // 消息类型
|
||
|
char from[MAX_NAME_LEN];
|
||
|
char to[MAX_NAME_LEN];
|
||
|
char data[MAX_MSG_LEN];
|
||
|
} Message;
|
||
|
|
||
|
#endif
|