plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

dat.h (2520B)


      1 #include "../dhcp.h"
      2 
      3 enum
      4 {
      5 	Maxstr=	256
      6 };
      7 
      8 typedef struct Binding Binding;
      9 struct Binding
     10 {
     11 	Binding *next;
     12 	uchar	ip[IPaddrlen];
     13 
     14 	char	*boundto;	/* id last bound to */
     15 	char	*offeredto;	/* id we've offered this to */
     16 
     17 	long	lease;		/* absolute time at which binding expires */
     18 	long	expoffer;	/* absolute time at which offer times out */
     19 	long	offer;		/* lease offered */
     20 	long	lasttouched;	/* time this entry last assigned/unassigned */
     21 	long	lastcomplained;	/* last time we complained about a used but not leased */
     22 	long	tried;		/* last time we tried this entry */
     23 
     24 	Qid	q;		/* qid at the last syncbinding */
     25 };
     26 
     27 typedef struct Info	Info;
     28 struct Info
     29 {
     30 	int	indb;			/* true if found in database */
     31 	char	domain[Maxstr];	/* system domain name */
     32 	char	bootf[Maxstr];		/* boot file */
     33 	char	bootf2[Maxstr];	/* alternative boot file */
     34 	uchar	tftp[NDB_IPlen];	/* ip addr of tftp server */
     35 	uchar	tftp2[NDB_IPlen];	/* ip addr of alternate server */
     36 	uchar	ipaddr[NDB_IPlen];	/* ip address of system */
     37 	uchar	ipmask[NDB_IPlen];	/* ip network mask */
     38 	uchar	ipnet[NDB_IPlen];	/* ip network address (ipaddr & ipmask) */
     39 	uchar	etheraddr[6];		/* ethernet address */
     40 	uchar	gwip[NDB_IPlen];	/* gateway ip address */
     41 	uchar	fsip[NDB_IPlen];	/* file system ip address */
     42 	uchar	auip[NDB_IPlen];	/* authentication server ip address */
     43 	char	rootpath[Maxstr];	/* rootfs for diskless nfs clients */
     44 	char	dhcpgroup[Maxstr];
     45 	char	vendor[Maxstr];	/* vendor info */
     46 };
     47 
     48 
     49 /* from dhcp.c */
     50 extern int	validip(uchar*);
     51 extern void	warning(int, char*, ...);
     52 extern int	minlease;
     53 
     54 /* from db.c */
     55 extern char*	tohex(char*, uchar*, int);
     56 extern char*	toid(uchar*, int);
     57 extern void	initbinding(uchar*, int);
     58 extern Binding*	iptobinding(uchar*, int);
     59 extern Binding*	idtobinding(char*, Info*, int);
     60 extern Binding*	idtooffer(char*, Info*);
     61 extern int	commitbinding(Binding*);
     62 extern int	releasebinding(Binding*, char*);
     63 extern int	samenet(uchar *ip, Info *iip);
     64 extern void	mkoffer(Binding*, char*, long);
     65 extern int	syncbinding(Binding*, int);
     66 
     67 /* from ndb.c */
     68 extern int	lookup(Bootp*, Info*, Info*);
     69 extern int	lookupip(uchar*, Info*, int);
     70 extern void	lookupname(char*, Ndbtuple*);
     71 extern Iplifc*	findlifc(uchar*);
     72 extern int	forme(uchar*);
     73 extern int	lookupserver(char*, uchar**, Ndbtuple *t);
     74 extern Ndbtuple* lookupinfo(uchar *ipaddr, char **attr, int n);
     75 
     76 /* from icmp.c */
     77 extern int	icmpecho(uchar*);
     78 
     79 extern char	*binddir;
     80 extern int	debug;
     81 extern char	*blog;
     82 extern Ipifc	*ipifcs;
     83 extern long	now;
     84 extern char	*ndbfile;