summaryrefslogtreecommitdiff
path: root/cbtcommon/tcpsocket.h
blob: ac606a56196d98b28b4a64b4dbd879545032916a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright 2001, 2002, 2003 David Mansfield and Cobite, Inc.
 * See COPYING file for license information 
 */

#ifndef _TCPSOCKET_H
#define _TCPSOCKET_H

#ifdef __cplusplus
extern "C" 
{
#endif

#ifndef LISTEN_QUEUE_SIZE
#define LISTEN_QUEUE_SIZE 5
#endif

#define REUSE_ADDR        1
#define NO_REUSE_ADDR     0

int tcp_create_socket(int reuse_addr);
int tcp_bind_and_listen(int sockfd, unsigned short tcpport);
int tcp_accept_connection(int sockfd);
unsigned int tcp_get_client_ip(int fd);
int tcp_connect(int sockfd, const char *rem_addr, unsigned short port);
int convert_address(long *dest, const char *addr_str);
int tcp_get_local_address(int sockfd, unsigned int *, unsigned short *);

#ifdef __cplusplus
}
#endif

#endif /* TCPSOCKET_H */