Last change
on this file since 40 was 40, checked in by cheese, 11 years ago |
#1 change interface of log from context to id-number
|
File size:
1.6 KB
|
Rev | Line | |
---|
[4] | 1 | /**
|
---|
[26] | 2 | * @file cf_socket.h
|
---|
| 3 | * @author myusgun <myusgun@gmail.com>
|
---|
| 4 | * @version 0.1
|
---|
[34] | 5 | *
|
---|
| 6 | * @remark TCP 소켓만 지원됨
|
---|
| 7 | *
|
---|
[35] | 8 | * @example socket_server.c
|
---|
| 9 | * @example socket_client.c
|
---|
[4] | 10 | */
|
---|
| 11 | #ifndef __CF_SOCKET_H__
|
---|
| 12 | #define __CF_SOCKET_H__
|
---|
| 13 |
|
---|
| 14 | #include "cf_base.h"
|
---|
| 15 | #include <stddef.h>
|
---|
| 16 |
|
---|
[21] | 17 | #ifdef _WIN32
|
---|
| 18 | # include <WinSock2.h>
|
---|
| 19 | #else
|
---|
| 20 | # include <netinet/in.h>
|
---|
| 21 | # include <sys/socket.h>
|
---|
| 22 | # include <arpa/inet.h>
|
---|
| 23 | # include <netdb.h>
|
---|
| 24 | # include <unistd.h>
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
[6] | 27 | #ifdef _WIN32
|
---|
| 28 | typedef int socklen_t;
|
---|
| 29 | #endif // #ifdef _WIN32
|
---|
| 30 |
|
---|
[4] | 31 | #ifdef __cplusplus
|
---|
| 32 | extern "C" {
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
[6] | 35 | CF_EXPORT CF_BOOL
|
---|
[4] | 36 | CF_Socket_IsInitialized (void);
|
---|
| 37 |
|
---|
| 38 | CF_EXPORT int
|
---|
| 39 | CF_Socket_Initialize (void);
|
---|
| 40 |
|
---|
| 41 | CF_EXPORT int
|
---|
| 42 | CF_Socket_Finalize (void);
|
---|
| 43 |
|
---|
| 44 | CF_EXPORT int
|
---|
| 45 | CF_Socket_Close (const int sock);
|
---|
| 46 |
|
---|
| 47 | CF_EXPORT int
|
---|
| 48 | CF_Socket_SetOption (const int sock,
|
---|
| 49 | const int optname,
|
---|
| 50 | const void * optval,
|
---|
| 51 | const size_t optlen);
|
---|
| 52 |
|
---|
| 53 | CF_EXPORT int
|
---|
| 54 | CF_Socket_GetOption (const int sock,
|
---|
| 55 | const int optname,
|
---|
| 56 | void * optval,
|
---|
| 57 | size_t * optlen);
|
---|
| 58 |
|
---|
| 59 | CF_EXPORT int
|
---|
| 60 | CF_Socket_SetTimeout (const int sock,
|
---|
| 61 | const int timeout);
|
---|
| 62 |
|
---|
| 63 | CF_EXPORT int
|
---|
| 64 | CF_Socket_Connect (const char * ip,
|
---|
| 65 | const unsigned short port);
|
---|
| 66 |
|
---|
| 67 | CF_EXPORT int
|
---|
| 68 | CF_Socket_Server (const unsigned short port,
|
---|
| 69 | const int backlog);
|
---|
| 70 |
|
---|
| 71 | CF_EXPORT int
|
---|
[21] | 72 | CF_Socket_Accept (const int sock,
|
---|
| 73 | struct sockaddr_in * address);
|
---|
[4] | 74 |
|
---|
| 75 | CF_EXPORT int
|
---|
| 76 | CF_Socket_Send (const int sock,
|
---|
| 77 | const void * buf,
|
---|
| 78 | const int len);
|
---|
| 79 |
|
---|
| 80 | CF_EXPORT int
|
---|
| 81 | CF_Socket_Recv (const int sock,
|
---|
| 82 | void * buf,
|
---|
| 83 | const int len);
|
---|
| 84 |
|
---|
| 85 | #ifdef __cplusplus
|
---|
| 86 | }
|
---|
| 87 | #endif
|
---|
| 88 |
|
---|
| 89 | #endif // #ifndef __CF_SOCKET_H__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.