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