Line | |
---|
1 | /**
|
---|
2 | * \file cf_socket.h
|
---|
3 | *
|
---|
4 | * \author myusgun <myusgun@gmail.com>
|
---|
5 | *
|
---|
6 | * \brief TCP 소켓 지원
|
---|
7 | *
|
---|
8 | * \example socket.c
|
---|
9 | */
|
---|
10 | #ifndef __CF_SOCKET_H__
|
---|
11 | #define __CF_SOCKET_H__
|
---|
12 |
|
---|
13 | #include "cf_base.h"
|
---|
14 |
|
---|
15 | #include <stddef.h>
|
---|
16 |
|
---|
17 | /** 타임아웃을 설정하지 않음 */
|
---|
18 | #define CF_SOCKET_NO_TIMEOUT 0
|
---|
19 |
|
---|
20 | #ifdef __cplusplus
|
---|
21 | extern "C" {
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | CF_EXPORT int
|
---|
25 | CF_Socket_Initialize (void);
|
---|
26 |
|
---|
27 | CF_EXPORT int
|
---|
28 | CF_Socket_Finalize (void);
|
---|
29 |
|
---|
30 | CF_EXPORT int
|
---|
31 | CF_Socket_Create (cf_ctx * ctx);
|
---|
32 |
|
---|
33 | CF_EXPORT int
|
---|
34 | CF_Socket_Close (cf_ctx ctx);
|
---|
35 |
|
---|
36 | CF_EXPORT int
|
---|
37 | CF_Socket_Connect (cf_ctx ctx,
|
---|
38 | const char * ip,
|
---|
39 | const unsigned short port);
|
---|
40 |
|
---|
41 | CF_EXPORT int
|
---|
42 | CF_Socket_Server (cf_ctx ctx,
|
---|
43 | const unsigned short port,
|
---|
44 | const int backlog);
|
---|
45 |
|
---|
46 | CF_EXPORT int
|
---|
47 | CF_Socket_Accept (const cf_ctx ctx,
|
---|
48 | cf_ctx * client);
|
---|
49 |
|
---|
50 | CF_EXPORT int
|
---|
51 | CF_Socket_Send (const cf_ctx ctx,
|
---|
52 | const void * buf,
|
---|
53 | const size_t len);
|
---|
54 |
|
---|
55 | CF_EXPORT int
|
---|
56 | CF_Socket_Recv (const cf_ctx ctx,
|
---|
57 | void * buf,
|
---|
58 | const size_t len);
|
---|
59 |
|
---|
60 | CF_EXPORT int
|
---|
61 | CF_Socket_SetOption (const cf_ctx ctx,
|
---|
62 | const int optname,
|
---|
63 | const void * optval,
|
---|
64 | const size_t optlen);
|
---|
65 |
|
---|
66 | CF_EXPORT int
|
---|
67 | CF_Socket_GetOption (const cf_ctx ctx,
|
---|
68 | const int optname,
|
---|
69 | void * optval,
|
---|
70 | size_t * optlen);
|
---|
71 |
|
---|
72 | CF_EXPORT int
|
---|
73 | CF_Socket_SetTimeOut (cf_ctx ctx,
|
---|
74 | int timeout);
|
---|
75 |
|
---|
76 | CF_EXPORT int
|
---|
77 | CF_Socket_GetIP (const cf_ctx ctx,
|
---|
78 | char * ip);
|
---|
79 |
|
---|
80 | CF_EXPORT int
|
---|
81 | CF_Socket_GetPort (const cf_ctx ctx,
|
---|
82 | unsigned short * port);
|
---|
83 |
|
---|
84 | #ifdef __cplusplus
|
---|
85 | }
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | #endif // #ifndef __CF_SOCKET_H__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.