source: libcf/trunk/include/cf_socket.h@ 151

Last change on this file since 151 was 151, checked in by cheese, 11 years ago

#1 fix interface and add util module

File size: 1.6 KB
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
21extern "C" {
22#endif
23
24CF_EXPORT int
25CF_Socket_Initialize (void);
26
27CF_EXPORT int
28CF_Socket_Finalize (void);
29
30CF_EXPORT int
31CF_Socket_Create (cf_ctx * ctx);
32
33CF_EXPORT int
34CF_Socket_Close (cf_ctx ctx);
35
36CF_EXPORT int
37CF_Socket_Connect (cf_ctx ctx,
38 const char * ip,
39 const unsigned short port);
40
41CF_EXPORT int
42CF_Socket_Server (cf_ctx ctx,
43 const unsigned short port,
44 const int backlog);
45
46CF_EXPORT int
47CF_Socket_Accept (const cf_ctx ctx,
48 cf_ctx * client);
49
50CF_EXPORT int
51CF_Socket_Send (const cf_ctx ctx,
52 const void * buf,
53 const size_t len);
54
55CF_EXPORT int
56CF_Socket_Recv (const cf_ctx ctx,
57 void * buf,
58 const size_t len);
59
60CF_EXPORT int
61CF_Socket_SetOption (const cf_ctx ctx,
62 const int optname,
63 const void * optval,
64 const size_t optlen);
65
66CF_EXPORT int
67CF_Socket_GetOption (const cf_ctx ctx,
68 const int optname,
69 void * optval,
70 size_t * optlen);
71
72CF_EXPORT int
73CF_Socket_SetTimeOut (cf_ctx ctx,
74 int timeout);
75
76CF_EXPORT int
77CF_Socket_GetIP (const cf_ctx ctx,
78 char * ip);
79
80CF_EXPORT int
81CF_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.