1 /*tcpstuff.h*/
2 
3 #include <string.h> /*for memcpy and such*/
4 
5 #include <sys/types.h>
6 #include <sys/socket.h>
7 #include <netdb.h> /*for gethostbyname()*/
8 #include <netinet/in.h> /*htonl()*/
9 #include <unistd.h> /*close*/
10 #include <stdlib.h> /*malloc*/
11 #include <stdio.h> /*printf*/
12 /*other inet_ stuff*/
13 #include <sys/socket.h>
14 #include <arpa/inet.h>
15 
16 #include "portability.h" /*for uint32*/
17 
18 int
19 getHostAddress(const char *host, struct sockaddr_in *addrP);
20 
21 int
22 tcpconnect(const char * host,  const unsigned short port );
23 
24 /*this actually just calls read_data - but it also does the ntohl()*/
25 int
26 read_uint32(int fd,uint32 *result);
27 
28 
29 /*write some data to the network. Also does encryption*/
30 int
31 write_data(int fd,uint32 size, unsigned char *inbuffer);
32 
33 /*reads some data from the network. Also does encryption.*/
34 int
35 read_data(int fd, uint32 size, unsigned char *buffer);
36 
37 /*makes a listener - returns into fd, 0 if fail, 1 if success*/
38 int
39 make_tcp_listener(unsigned short localport, int *fd);
40 
41 /*writes a uint32 to the network in network byte order*/
42 int
43 write_uint32(int fd,uint32 data);
44 
45 /* This is not used and gives a warning in FreeBSD's ports system
46 int
47 tcp_accept(int listenFd);
48 */
49