File: network.h

package info (click to toggle)
poc-streamer 0.4.2-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,000 kB
  • sloc: ansic: 8,782; makefile: 307; ruby: 152; perl: 135; yacc: 115; lex: 36; sh: 30
file content (60 lines) | stat: -rw-r--r-- 1,884 bytes parent folder | download | duplicates (5)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*C
  (c) 2005 bl0rg.net
**/

#ifndef NET_H__
#define NET_H__

#include "netinet/in.h"

int net_ip4_resolve_hostname(const char *hostname,
                             unsigned short port,
                             unsigned char ip[4],
                             struct sockaddr_in *saddr);

int net_udp4_socket(struct sockaddr_in *saddr,
		    unsigned short port,
		    unsigned char ttl);
int net_udp4_send_socket(char *hostname,
                         unsigned short port,
                         unsigned char ttl);
int net_udp4_recv_socket(char *hostname,
                         unsigned short port);

int net_tcp4_nonblock_socket(void);
int net_tcp4_socket_nonblock(int s);
int net_tcp4_bind(int s,
                  unsigned char ip[4],
                  unsigned short port);
int net_tcp4_bind_reuse(int s,
                        unsigned char ip[4],
                        unsigned short port);
int net_tcp4_listen_socket(char *hostname, unsigned short port);
int net_tcp4_accept_socket(int s, unsigned char ip[4], unsigned short *port);

#ifdef WITH_IPV6
int net_udp6_send_socket(char *hostname,
                         unsigned short port,
                         unsigned int hops);
int net_udp6_recv_socket(char *hostname,
                         unsigned short port);

int net_tcp6_nonblock_socket(void);
int net_tcp6_socket_nonblock(int s);
int net_tcp6_bind(int s,
                  unsigned char ip[4],
                  unsigned short port);
int net_tcp6_bind_reuse(int s,
                        unsigned char ip[4],
                        unsigned short port);
int net_tcp6_listen_socket(char *hostname, unsigned short port);
int net_tcp6_accept_socket(int s, unsigned char ip[16], unsigned short *port);
#endif

int net_seqnum_diff(unsigned long seq1, unsigned long seq2,
                    unsigned long maxseq);

/*C
**/

#endif /* NET_H__ */