CUBRID Engine  latest
tcp.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * tcp.h -
22  */
23 
24 #ifndef _TCP_H_
25 #define _TCP_H_
26 
27 #ident "$Id$"
28 
29 #include "config.h"
30 #include "connection_defs.h"
31 
32 #if !defined (WINDOWS)
33 #include <sys/socket.h>
34 #endif /* !WINDOWS */
35 
36 extern int css_gethostname (char *name, size_t namelen);
37 extern unsigned int css_gethostid (void);
38 #if defined (ENABLE_UNUSED_FUNCTION)
39 extern int css_fd_down (SOCKET fd);
40 #endif
41 extern char *css_get_master_domain_path (void);
42 
43 extern SOCKET css_tcp_client_open (const char *host, int port);
44 extern SOCKET css_tcp_client_open_with_retry (const char *host, int port, bool will_retry);
45 extern int css_tcp_master_open (int port, SOCKET * sockfd);
46 extern bool css_tcp_setup_server_datagram (const char *pathname, SOCKET * sockfd);
47 extern bool css_tcp_listen_server_datagram (SOCKET sockfd, SOCKET * newfd);
48 extern bool css_tcp_master_datagram (char *pathname, SOCKET * sockfd);
49 extern SOCKET css_master_accept (SOCKET sockfd);
50 extern SOCKET css_open_new_socket_from_master (SOCKET fd, unsigned short *rid);
51 extern bool css_transfer_fd (SOCKET server_fd, SOCKET client_fd, unsigned short rid, CSS_SERVER_REQUEST request);
52 extern void css_shutdown_socket (SOCKET fd);
53 extern int css_open_server_connection_socket (void);
54 extern void css_close_server_connection_socket (void);
55 extern SOCKET css_server_accept (SOCKET sockfd);
56 extern int css_get_max_socket_fds (void);
57 
58 extern int css_tcp_client_open_with_timeout (const char *host, int port, int timeout);
59 #if !defined (WINDOWS)
60 extern int css_ping (SOCKET sd, struct sockaddr_in *sa_send, int timeout);
61 extern bool css_peer_alive (SOCKET sd, int timeout);
62 extern int css_hostname_to_ip (const char *host, unsigned char *ip_addr);
63 #endif /* !WINDOWS */
64 
65 extern int css_get_peer_name (SOCKET sockfd, char *hostname, size_t len);
66 extern int css_get_sock_name (SOCKET sockfd, char *hostname, size_t len);
67 #endif /* _TCP_H_ */
int css_hostname_to_ip(const char *host, unsigned char *ip_addr)
Definition: tcp.c:227
int SOCKET
Definition: porting.h:482
SOCKET css_tcp_client_open_with_retry(const char *host, int port, bool will_retry)
Definition: tcp.c:414
bool css_tcp_setup_server_datagram(const char *pathname, SOCKET *sockfd)
Definition: tcp.c:882
void css_close_server_connection_socket(void)
Definition: tcp.c:1242
SOCKET css_server_accept(SOCKET sockfd)
Definition: tcp.c:1256
int css_tcp_master_open(int port, SOCKET *sockfd)
Definition: tcp.c:663
bool css_transfer_fd(SOCKET server_fd, SOCKET client_fd, unsigned short rid, CSS_SERVER_REQUEST request)
Definition: tcp.c:1122
bool css_tcp_listen_server_datagram(SOCKET sockfd, SOCKET *newfd)
Definition: tcp.c:930
SOCKET css_open_new_socket_from_master(SOCKET fd, unsigned short *rid)
Definition: tcp.c:1059
void css_shutdown_socket(SOCKET fd)
Definition: tcp.c:1179
int css_ping(SOCKET sd, struct sockaddr_in *sa_send, int timeout)
char * css_get_master_domain_path(void)
Definition: tcp.c:155
int css_get_max_socket_fds(void)
Definition: tcp.c:1315
int css_get_peer_name(SOCKET sockfd, char *hostname, size_t len)
Definition: tcp.c:1592
unsigned int css_gethostid(void)
Definition: tcp.c:1209
bool css_peer_alive(SOCKET sd, int timeout)
Definition: tcp.c:1470
SOCKET css_master_accept(SOCKET sockfd)
Definition: tcp.c:836
bool css_tcp_master_datagram(char *pathname, SOCKET *sockfd)
Definition: tcp.c:967
enum css_server_request CSS_SERVER_REQUEST
int css_tcp_client_open_with_timeout(const char *host, int port, int timeout)
Definition: tcp.c:550
static char * host
int css_gethostname(char *name, size_t namelen)
Definition: tcp.c:114
int css_open_server_connection_socket(void)
Definition: tcp.c:1228
SOCKET css_tcp_client_open(const char *host, int port)
Definition: tcp.c:182
int css_get_sock_name(SOCKET sockfd, char *hostname, size_t len)
Definition: tcp.c:1618