Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/ndb/glean/nbcache.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



enum {
	Etheraddrlen = 6,
	NBnamelen = 17,		/* 16 + '\0' */
	Defttl = 20*60		/* default TTL for unknown sources in secs */
};

typedef struct Attr Attr;
typedef struct Node Node;
typedef struct Pkt Pkt;
typedef void (Disect)(Pkt *);

struct Attr {
	Attr *next;
	Attr *child;
	char *name;
	char *value;
	long mtime;
	long ttl;
	long hits;
};

struct Node {
	Node *next;
	Attr *attrs;
	long mtime;
	long ttl;
	char *value;
	long hits;
};

struct Pkt {
	uchar *buf;
	Udphdr *up;
	uchar *end;
	uchar *pos;
	int size;
	jmp_buf err;
};



enum {
	Thost,
	Tdomain
};

extern Pkt *allocpkt(int);
extern void readpkt(int, Pkt *);
extern void w8(Pkt *, int);
extern int r8(Pkt *);
extern int rl16(Pkt *);
extern void wl16(Pkt *, int);
extern int rb16(Pkt *);
extern void wb16(Pkt *, int);
extern int rl32(Pkt *);
extern void wl32(Pkt *, int);
extern int rb32(Pkt *);
extern void wb32(Pkt *, int);
extern void skip(Pkt *, int);
extern void rmem(Pkt *, void *, int);
extern void wmem(Pkt *, void *, int);
extern void rstr(Pkt *, char *, int);
extern void wstr(Pkt *, char *);
extern int rnbname(Pkt *, char *, int);
extern void pnbname(Pkt *, char *, char, char);

extern Disect nbns;
extern Disect dhcp;
extern Disect browse;
extern Disect dump;
extern Disect iap;

extern char *snapshot(void);
extern Node *getnode(int, long, char *, ...);
extern Attr *setval(Node *, char *, char *, ...);
extern int lookval(Attr *, char *);
extern void addval(Attr *, char *, char *, ...);

extern void strlwr(char *);
extern void trim(char *, char);
extern uchar *lookarp(uchar *);
extern char *nicvendor(uchar *);
extern char *servname(int, int);

extern void listener(void);

extern int adapter_status(Attr *, int, uchar *);

extern int Passive;
extern char *Netdir;
extern int Debug;

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].