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

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

#1 add typical data structure algorithms (linked-list / queue / stak) and rename symbol for context of each modules

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