Linux/Project/新建文件夹/protocol.h

22 lines
435 B
C
Raw Permalink Normal View History

2025-06-10 23:43:56 +08:00
// 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