]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/notlist.h
12962af5ec00c18c16bbfd032efdc6192b578b8e
[nfs-utils.git] / utils / statd / notlist.h
1 /* 
2  * Copyright (C) 1995, 1997-1999, 2002 Jeffrey A. Uphoff
3  * Major rewrite by Olaf Kirch, Dec. 1996.
4  *
5  * NSM for Linux.
6  */
7
8 #include <netinet/in.h>
9
10 /*
11  * Primary information structure.
12  */
13 struct notify_list {
14   mon                   mon;    /* Big honkin' NSM structure. */
15   struct in_addr        addr;   /* IP address for callback. */
16   unsigned short        port;   /* port number for callback */
17   short int             times;  /* Counter used for various things. */
18   int                   state;  /* For storing notified state for callbacks. */
19   struct notify_list    *next;  /* Linked list forward pointer. */
20   struct notify_list    *prev;  /* Linked list backward pointer. */
21   u_int32_t             xid;    /* XID of MS_NOTIFY RPC call */
22   time_t                when;   /* notify: timeout for re-xmit */
23 };
24
25 typedef struct notify_list notify_list;
26
27 /*
28  * Global Variables
29  */
30 extern notify_list *    rtnl;   /* Run-time notify list */
31 extern notify_list *    notify; /* Pending RPC calls */
32
33 /*
34  * List-handling functions
35  */
36 extern notify_list *    nlist_new(char *, char *, int);
37 extern void             nlist_insert(notify_list **, notify_list *);
38 extern void             nlist_remove(notify_list **, notify_list *);
39 extern void             nlist_insert_timer(notify_list **, notify_list *);
40 extern notify_list *    nlist_clone(notify_list *);
41 extern void             nlist_free(notify_list **, notify_list *);
42 extern void             nlist_kill(notify_list **);
43 extern notify_list *    nlist_gethost(notify_list *, char *, int);
44
45 /* 
46  * List-handling macros.
47  * THESE INHERIT INFORMATION FROM PREVIOUSLY-DEFINED MACROS.
48  * (So don't change their order unless you study them first!)
49  */
50 #define NL_NEXT(L)      ((L)->next)
51 #define NL_FIRST        NL_NEXT
52 #define NL_PREV(L)      ((L)->prev)
53 #define NL_DATA(L)      ((L)->mon)
54 #define NL_ADDR(L)      ((L)->addr)
55 #define NL_STATE(L)     ((L)->state)
56 #define NL_TIMES(L)     ((L)->times)
57 #define NL_MON_ID(L)    (NL_DATA((L)).mon_id)
58 #define NL_PRIV(L)      (NL_DATA((L)).priv)
59 #define NL_MON_NAME(L)  (NL_MON_ID((L)).mon_name)
60 #define NL_MY_ID(L)     (NL_MON_ID((L)).my_id)
61 #define NL_MY_NAME(L)   (NL_MY_ID((L)).my_name)
62 #define NL_MY_PROC(L)   (NL_MY_ID((L)).my_proc)
63 #define NL_MY_PROG(L)   (NL_MY_ID((L)).my_prog)
64 #define NL_MY_VERS(L)   (NL_MY_ID((L)).my_vers)
65 #define NL_WHEN(L)      ((L)->when)