Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
HR_Socket_Msg_Demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马伊齐
HR_Socket_Msg_Demo
Commits
0c137f1d
Commit
0c137f1d
authored
Dec 19, 2023
by
马伊齐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加注册注销部分
parent
d58ca550
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
sock_msg.c
lib/sock_msg.c
+1
-7
sock_msg.h
lib/sock_msg.h
+11
-1
No files found.
lib/sock_msg.c
View file @
0c137f1d
...
@@ -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
};
...
...
lib/sock_msg.h
View file @
0c137f1d
...
@@ -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句柄
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment