summaryrefslogtreecommitdiff
path: root/other/3wahas/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'other/3wahas/network.h')
-rw-r--r--other/3wahas/network.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/other/3wahas/network.h b/other/3wahas/network.h
new file mode 100644
index 0000000..b244165
--- /dev/null
+++ b/other/3wahas/network.h
@@ -0,0 +1,126 @@
1
2/* zodiac - advanced dns spoofer
3 *
4 * ripped down network.c for use with zodiac
5 *
6 * by scut / teso
7 */
8
9#ifndef Z_NETWORK_H
10#define Z_NETWORK_H
11
12#include <sys/socket.h>
13#include <net/if.h>
14#include <netinet/in.h>
15#include <stdio.h>
16
17#define IFI_NAME 16
18#define IFI_HADDR 8
19
20/* struct ifi_info
21 *
22 * a linked list giving information about all the network interfaces available
23 * a pointer to this struct list is returned by net_get_ifi.
24 */
25
26struct ifi_info {
27 char ifi_name[IFI_NAME];
28 u_char ifi_haddr[IFI_HADDR];
29 u_short ifi_hlen;
30 short ifi_flags;
31 short ifi_myflags;
32 struct sockaddr *ifi_addr;
33 struct in_addr ifi_saddr;
34 struct ifi_info *ifi_next;
35};
36
37#define IFI_ALIAS 1
38
39typedef struct bound {
40 int bs; /* bound socket */
41 unsigned short port; /* port we bound to */
42 struct sockaddr bsa; /* bs_in */
43} bound;
44
45extern int net_readtimeout;
46extern int net_conntimeout;
47extern int net_identtimeout;
48
49
50/* net_parseip
51 *
52 * read an ip in the format "1.1.1.1:299" or "blabla:481" into
53 * the char pointer *ip and into the port *port
54 *
55 * return 0 on failure
56 * return 1 on success
57 */
58
59int net_parseip (char *inp, char **ip, unsigned short int *port);
60
61
62/* net_getlocalip
63 *
64 * give back the main IP of the local machine
65 *
66 * return the local IP address as string on success
67 * return NULL on failure
68 */
69
70char *net_getlocalip (void);
71
72
73/* net_get_ifi
74 *
75 * get network interface information
76 *
77 * return NULL on failure
78 * return a pointer to a linked list structure ifi_info (see above)
79 */
80
81struct ifi_info *net_ifi_get (int family, int doaliases);
82
83
84/* net_ifi_free
85 *
86 * free the linked list associated with `tf'.
87 *
88 * return in any case
89 */
90
91void net_ifi_free (struct ifi_info *tf);
92
93
94/* net_resolve
95 *
96 * resolve a hostname pointed to by `host' into a s_addr return value
97 *
98 * return the correct formatted `s_addr' for this host on success
99 * return 0 on failure
100 */
101
102unsigned long int net_resolve (char *host);
103
104
105/* net_printip
106 *
107 * print an IP address stored in the struct in_addr pointed to by `ia' to a
108 * string `str' with a maximum length of `len'.
109 *
110 * return 0 on success
111 *Üreturn 1 on failure
112 *
113 * net_printipa behaves the same way, except it allocates memory and let
114 * `*str' point to the string
115 *
116 * net_printipr behaves like net_printip, except the IP is printed in
117 * reverse quad dotted order (dns labels)
118 */
119
120int net_printip (struct in_addr *ia, char *str, size_t len);
121int net_printipa (struct in_addr *ia, char **str);
122int net_printipr (struct in_addr *ia, char *str, size_t len);
123
124
125#endif
126