]> git.sur5r.net Git - ngadmin/blob - lib/src/lib.h
Use portable way to handle timeouts
[ngadmin] / lib / src / lib.h
1
2 #ifndef DEF_LIB
3 #define DEF_LIB
4
5
6 #include <arpa/inet.h>
7
8 #include <net/if.h>
9 #include <netinet/ether.h>
10
11 #include <ngadmin.h>
12
13
14
15 #define PASSWORD_MAX            32
16
17
18 struct ngadmin {
19         /* network */
20         int sock;                       /* socket */
21         struct sockaddr_in local;       /* local address & port */
22         struct in_addr brd;             /* broadcast address */
23         char iface[IFNAMSIZ];           /* interface */
24         struct timespec timeout;        /* timeout */
25         struct ether_addr localmac;     /* local MAC address */
26         bool keepbroad;                 /* keep broadcasting */
27         bool globalbroad;               /* use global broadcast address (255.255.255.255) */
28         /* switch properties */
29         bool encrypt_pass;              /* switch uses password "encryption" */
30         char password[PASSWORD_MAX];    /* password to use to login on switches */
31         struct swi_attr *swi_tab;       /* array of detected switches */
32         int swi_count;                  /* number of detected switches */
33         struct swi_attr *current;       /* administred switch */
34         int seq;                        /* sequence number for packets */
35 };
36
37
38 #endif
39