]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/notlist.h
Merge branch 'sid'
[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   in_port_t             port;   /* port number for callback */
16   short int             times;  /* Counter used for various things. */
17   int                   state;  /* For storing notified state for callbacks. */
18   char                  *dns_name; /* used for matching incoming
19                                     * NOTIFY requests */
20   struct notify_list    *next;  /* Linked list forward pointer. */
21   struct notify_list    *prev;  /* Linked list backward pointer. */
22   uint32_t              xid;    /* XID of MS_NOTIFY RPC call */
23   time_t                when;   /* notify: timeout for re-xmit */
24 };
25
26 typedef struct notify_list notify_list;
27
28 /*
29  * Global Variables
30  */
31 extern notify_list *    rtnl;   /* Run-time notify list */
32 extern notify_list *    notify; /* Pending RPC calls */
33
34 /*
35  * List-handling functions
36  */
37 extern notify_list *    nlist_new(char *, char *, int);
38 extern void             nlist_insert(notify_list **, notify_list *);
39 extern void             nlist_remove(notify_list **, notify_list *);
40 extern void             nlist_insert_timer(notify_list **, notify_list *);
41 extern notify_list *    nlist_clone(notify_list *);
42 extern void             nlist_free(notify_list **, notify_list *);
43 extern void             nlist_kill(notify_list **);
44 extern notify_list *    nlist_gethost(notify_list *, char *, int);
45
46 /* 
47  * List-handling macros.
48  * THESE INHERIT INFORMATION FROM PREVIOUSLY-DEFINED MACROS.
49  * (So don't change their order unless you study them first!)
50  */
51 #define NL_NEXT(L)      ((L)->next)
52 #define NL_FIRST        NL_NEXT
53 #define NL_PREV(L)      ((L)->prev)
54 #define NL_DATA(L)      ((L)->mon)
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)