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

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

#1 로깅을 제외한 기본 코드 커밋

File size: 2.2 KB
Line 
1/**
2 * cf_socket.h
3 */
4#ifndef __CF_SOCKET_H__
5#define __CF_SOCKET_H__
6
7#include "cf_base.h"
8#include <stddef.h>
9
10#ifdef _WIN32
11typedef int socklen_t;
12#endif // #ifdef _WIN32
13
14#define CF_ERROR_SOCKET CF_ERROR_BASE * 3
15
16#define CF_ERROR_SOCKET_INITIALIZE CF_ERROR_SOCKET - 1
17#define CF_ERROR_SOCKET_NOT_INITIALIZED CF_ERROR_SOCKET - 2
18#define CF_ERROR_SOCKET_FINALIZE CF_ERROR_SOCKET - 3
19#define CF_ERROR_SOCKET_CLOSE CF_ERROR_SOCKET - 4
20#define CF_ERROR_SOCKET_CREATE CF_ERROR_SOCKET - 5
21#define CF_ERROR_SOCKET_CONNECT CF_ERROR_SOCKET - 6
22#define CF_ERROR_SOCKET_SET_OPTION CF_ERROR_SOCKET - 7
23#define CF_ERROR_SOCKET_GET_OPTION CF_ERROR_SOCKET - 8
24#define CF_ERROR_SOCKET_SET_TIMEOUT CF_ERROR_SOCKET - 9
25#define CF_ERROR_SOCKET_INVALID_ARGS CF_ERROR_SOCKET - 10
26#define CF_ERROR_SOCKET_INVALID_SOCKET CF_ERROR_SOCKET - 11
27#define CF_ERROR_SOCKET_GET_HOST CF_ERROR_SOCKET - 12
28#define CF_ERROR_SOCKET_BIND CF_ERROR_SOCKET - 13
29#define CF_ERROR_SOCKET_LISTEN CF_ERROR_SOCKET - 14
30#define CF_ERROR_SOCKET_ACCEPT CF_ERROR_SOCKET - 15
31#define CF_ERROR_SOCKET_SEND CF_ERROR_SOCKET - 16
32#define CF_ERROR_SOCKET_RECV CF_ERROR_SOCKET - 17
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38CF_EXPORT E_CF_BOOL
39CF_Socket_IsInitialized (void);
40
41CF_EXPORT int
42CF_Socket_Initialize (void);
43
44CF_EXPORT int
45CF_Socket_Finalize (void);
46
47CF_EXPORT int
48CF_Socket_Close (const int sock);
49
50CF_EXPORT int
51CF_Socket_SetOption (const int sock,
52 const int optname,
53 const void * optval,
54 const size_t optlen);
55
56CF_EXPORT int
57CF_Socket_GetOption (const int sock,
58 const int optname,
59 void * optval,
60 size_t * optlen);
61
62CF_EXPORT int
63CF_Socket_SetTimeout (const int sock,
64 const int timeout);
65
66CF_EXPORT int
67CF_Socket_Connect (const char * ip,
68 const unsigned short port);
69
70CF_EXPORT int
71CF_Socket_Server (const unsigned short port,
72 const int backlog);
73
74CF_EXPORT int
75CF_Socket_Accept (const int sock,
76 void * address /* struct sockaddr_in * */);
77
78CF_EXPORT int
79CF_Socket_Send (const int sock,
80 const void * buf,
81 const int len);
82
83CF_EXPORT int
84CF_Socket_Recv (const int sock,
85 void * buf,
86 const int len);
87
88#ifdef __cplusplus
89}
90#endif
91
92#endif // #ifndef __CF_SOCKET_H__
Note: See TracBrowser for help on using the repository browser.