forked from OpenCloudOS/perf-prof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
net.h
27 lines (18 loc) · 721 Bytes
/
net.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef __NET_H
#define __NET_H
#include <sys/types.h>
#include <sys/socket.h>
struct tcp_socket_ops {
void *client;
void *server;
struct tcp_socket_ops *server_ops;
int (*process_event)(union perf_event *event, struct tcp_socket_ops *ops);
int (*disconnect)(struct tcp_socket_ops *ops);
int (*new_client)(struct tcp_socket_ops *ops);
};
void *tcp_server(const char *node, const char *service, struct tcp_socket_ops *ops);
int tcp_send(void *cli, const void *buf, size_t len, int flags);
int tcp_server_broadcast(void *server, const void *buf, size_t len, int flags);
void *tcp_connect(const char *node, const char *service, struct tcp_socket_ops *ops);
void tcp_close(void *tcp);
#endif