diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2010-07-09 12:32:17 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2010-07-09 12:32:17 +0200 |
commit | 6c027b4de25a529908be895e7ff19236f4002a57 (patch) | |
tree | f70d3a400bbb9ba8a83e9d4ffcaa4b6e367fc8bb /ipv4.h | |
download | crypto-6c027b4de25a529908be895e7ff19236f4002a57.zip crypto-6c027b4de25a529908be895e7ff19236f4002a57.tar.gz |
initial commit, resurrect one of my realy old projects
Diffstat (limited to 'ipv4.h')
-rw-r--r-- | ipv4.h | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -0,0 +1,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 |