summaryrefslogtreecommitdiffstats
path: root/ipv4.h
blob: 608b9016ccddaab9db3b35ace4fd30b182526dbb (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
34
35
36
37
38
#ifndef _INTE4_H
#define _INTE4_H

#define NIPQUAD(addr) \
	((unsigned char *)&addr)[0], \
	((unsigned char *)&addr)[1], \
	((unsigned char *)&addr)[2], \
	((unsigned char *)&addr)[3]

#define MAC(hwaddr) \
	((unsigned char *)&hwaddr)[0], \
	((unsigned char *)&hwaddr)[1], \
	((unsigned char *)&hwaddr)[2], \
	((unsigned char *)&hwaddr)[3], \
	((unsigned char *)&hwaddr)[4], \
	((unsigned char *)&hwaddr)[5]


int ipv4_get_addr  (const char *interface, char *ip, int *family);
int ipv4_get_broad (const char *interface, char *ip, int *family);
int ipv4_get_dest  (const char *interface, char *ip, int *family);
int ipv4_get_mask  (const char *interface, char *ip, int *family);
int ipv4_get_hwaddr(const char *ifname, char *mac, int *family);

int ipv4_set_addr  (const char *interface, const char *ip, int family);
int ipv4_set_broad (const char *interface, const char *ip, int family);
int ipv4_set_dest  (const char *interface, const char *ip, int family);
int ipv4_set_mask  (const char *interface, const char *ip, int family);
int ipv4_set_hwaddr(const char *ifname, const char *mac, int family);

/* set ifname up/down state 1/0 */
int ipv4_set_up(const char *ifname, unsigned int state);
int ipv4_get_up(const char *ifname);

/* numbers -gt 255 are truncated ( 256=>0 ; 257=>1 ) */
unsigned int ipv4_scan(const char *s,char *ip);

#endif