Commit 0c137f1d authored by 马伊齐's avatar 马伊齐

增加注册注销部分

parent d58ca550
...@@ -22,13 +22,7 @@ messageQueue *queue; ...@@ -22,13 +22,7 @@ messageQueue *queue;
// socket信息结构体
typedef struct
{
int fd;
sock_callback_t callback;
uint32_t mode;
} socket_info_t;
// 全局数组来保存socket信息 // 全局数组来保存socket信息
socket_info_t sockets[MAX_CLIENTS + 1] = {0}; socket_info_t sockets[MAX_CLIENTS + 1] = {0};
......
...@@ -27,7 +27,8 @@ typedef struct messageQueue{ ...@@ -27,7 +27,8 @@ typedef struct messageQueue{
}messageQueue; }messageQueue;
/** 定义函数指针类型 */ /** 定义函数指针类型 */
typedef int (*sock_callback_t)(int, uint8_t *, int); // typedef int (*sock_callback_t)(int, uint8_t*, int);
typedef void (*sock_callback_t)(int fd, uint32_t events);
// 全局的消息队列 // 全局的消息队列
#define MAX_MESSAGES 10 #define MAX_MESSAGES 10
...@@ -82,7 +83,16 @@ typedef struct ...@@ -82,7 +83,16 @@ typedef struct
char pad[BUFFER_SIZE]; char pad[BUFFER_SIZE];
} msg_data_t; } msg_data_t;
// socket信息结构体
typedef struct
{
int fd;
sock_callback_t callback;
uint32_t mode;
} socket_info_t;
extern int msgid; extern int msgid;
extern socket_info_t sockets[MAX_CLIENTS + 1];
/** /**
* @brief 初始化一个网络通讯用的socket句柄 * @brief 初始化一个网络通讯用的socket句柄
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment