-
Notifications
You must be signed in to change notification settings - Fork 2
/
net.h
92 lines (81 loc) · 1.68 KB
/
net.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef NETH
#define NETH
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/un.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <netdb.h>
#include "proto.h"
#ifdef USEIP4
#ifdef USETCP
#define USETCP4
#endif
#ifdef USEUDP
#define USEUDP4
#endif
#ifdef USESCTP
#define USESCTP4
#endif
#endif
#ifdef USEIP6
#ifdef USETCP
#define USETCP6
#endif
#ifdef USEUDP
#define USEUDP6
#endif
#ifdef USESCTP
#define USESCTP6
#endif
#endif
#ifdef USETCP
static const char STR_NAME_TCP[] = "tcp";
#endif
#ifdef USEUDP
static const char STR_NAME_UDP[] = "udp";
#endif
#ifdef USESCTP
static const char STR_NAME_SCTP[] = "stcp";
#endif
#ifdef USEUNIXSOCK
static const char STR_NAME_UNIX[] = "unix";
#endif
#ifdef USEUNIXSOCK
static const char STR_UNIX[] = "unix:";
#endif
#ifdef USETCP4
static const char STR_TCP4[] = "tcp://";
#endif
#ifdef USEUDP4
static const char STR_UDP4[] = "udp://";
#endif
#ifdef USESCTP4
static const char STR_SCTP4[] = "sctp://";
#endif
#ifdef USETCP6
static const char STR_TCP6[] = "tcp6://";
#endif
#ifdef USEUDP6
static const char STR_UDP6[] = "udp6://";
#endif
#ifdef USESCTP6
static const char STR_SCTP6[] = "sctp6://";
#endif
//static const char STR_UNIX[] = "";
struct net_param
{
const char* m_str;
size_t m_strlength;
const char* m_protoname;
int m_domain;
int m_type;
int m_protocol;
};
extern const struct net_param net_params[];
int parsetarget(char* target, struct hostent** host, int* port);
#endif