~ubuntu-branches/ubuntu/utopic/wide-dhcpv6/utopic

« back to all changes in this revision

Viewing changes to missing/sys/queue.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremie Corbier
  • Date: 2008-06-21 18:36:41 UTC
  • mfrom: (1.2.1 upstream) (6.1.8 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080621183641-nt4rwlen5yfyvrrh
Tags: 20080615-1
* New upstream release.
* Made it possible for the server to actually handle several network
  interfaces.  It required to remove the possibility to control the server
  with dhcp6ctl though.
* debian/control: no need to have Conflicts anymore since wide-dhcpv6-server
  no longer provides dhcp6ctl.
* debian/patches:
  -> Removed 001_use-sig_atomic_t.diff, 002_singular-point-check-fix.diff,
     003_sprint_uint64-buffer-overrun-fix.diff,
     004_dhcp6s_accepts_relayed_req_msgs_with_auth_opt.diff,
     005_possible-mem-leak-and-double-frees-fix.diff,
     010_incorrect-valid-lifetime-in-IA_NA.diff,
     020_malformed-OPTION_DOMAIN_LIST.diff,
     030_NULL-pointer-access-with-non-binding-Decline-messages.diff:
     fixed upstream.
  -> Updated 006_wide-dhcpv6-mans-update.diff: escape a minus sign in
     dhcp6c.conf.5 so it is not interpreted as a hyphen by groff.
* Bumped up Standards-Version to 3.8.0: no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 1991, 1993
 
3
 *      The Regents of the University of California.  All rights reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 * 1. Redistributions of source code must retain the above copyright
 
9
 *    notice, this list of conditions and the following disclaimer.
 
10
 * 2. Redistributions in binary form must reproduce the above copyright
 
11
 *    notice, this list of conditions and the following disclaimer in the
 
12
 *    documentation and/or other materials provided with the distribution.
 
13
 * 3. All advertising materials mentioning features or use of this software
 
14
 *    must display the following acknowledgement:
 
15
 *      This product includes software developed by the University of
 
16
 *      California, Berkeley and its contributors.
 
17
 * 4. Neither the name of the University nor the names of its contributors
 
18
 *    may be used to endorse or promote products derived from this software
 
19
 *    without specific prior written permission.
 
20
 *
 
21
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 
22
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
23
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
24
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 
25
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
26
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
27
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
28
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
29
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
30
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
31
 * SUCH DAMAGE.
 
32
 *
 
33
 * Adapted from FreeBSD sys/queue.h by James Carlson <james.d.carlson@sun.com>
 
34
 *
 
35
 *      @(#)queue.h     8.5 (Berkeley) 8/20/94
 
36
 * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.6 2001/12/18 10:09:02 ru Exp $
 
37
 */
 
38
 
 
39
/*
 
40
 * Tail queue declarations.
 
41
 */
 
42
#define TAILQ_HEAD(name, type)                                          \
 
43
struct name {                                                           \
 
44
        struct type *tqh_first; /* first element */                     \
 
45
        struct type **tqh_last; /* addr of last next element */         \
 
46
}
 
47
 
 
48
#define TAILQ_ENTRY(type)                                               \
 
49
struct {                                                                \
 
50
        struct type *tqe_next;  /* next element */                      \
 
51
        struct type **tqe_prev; /* address of previous next element */  \
 
52
}
 
53
 
 
54
/*
 
55
 * Tail queue functions.
 
56
 */
 
57
#define TAILQ_EMPTY(head)       ((head)->tqh_first == NULL)
 
58
 
 
59
#define TAILQ_FIRST(head)       ((head)->tqh_first)
 
60
 
 
61
#define TAILQ_INIT(head) do {                                           \
 
62
        TAILQ_FIRST((head)) = NULL;                                     \
 
63
        (head)->tqh_last = &TAILQ_FIRST((head));                        \
 
64
} while (0)
 
65
 
 
66
#define TAILQ_INSERT_HEAD(head, elm, field) do {                        \
 
67
        if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)   \
 
68
                TAILQ_FIRST((head))->field.tqe_prev =                   \
 
69
                    &TAILQ_NEXT((elm), field);                          \
 
70
        else                                                            \
 
71
                (head)->tqh_last = &TAILQ_NEXT((elm), field);           \
 
72
        TAILQ_FIRST((head)) = (elm);                                    \
 
73
        (elm)->field.tqe_prev = &TAILQ_FIRST((head));                   \
 
74
} while (0)
 
75
 
 
76
#define TAILQ_INSERT_TAIL(head, elm, field) do {                        \
 
77
        TAILQ_NEXT((elm), field) = NULL;                                \
 
78
        (elm)->field.tqe_prev = (head)->tqh_last;                       \
 
79
        *(head)->tqh_last = (elm);                                      \
 
80
        (head)->tqh_last = &TAILQ_NEXT((elm), field);                   \
 
81
} while (0)
 
82
 
 
83
#define TAILQ_LAST(head, headname)                                      \
 
84
        (*(((struct headname *)((head)->tqh_last))->tqh_last))
 
85
 
 
86
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
 
87
 
 
88
#define TAILQ_REMOVE(head, elm, field) do {                             \
 
89
        if ((TAILQ_NEXT((elm), field)) != NULL)                         \
 
90
                TAILQ_NEXT((elm), field)->field.tqe_prev =              \
 
91
                    (elm)->field.tqe_prev;                              \
 
92
        else                                                            \
 
93
                (head)->tqh_last = (elm)->field.tqe_prev;               \
 
94
        *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);              \
 
95
} while (0)
 
96
 
 
97
/*
 
98
 * List declarations.
 
99
 */
 
100
#define LIST_HEAD(name, type)                                           \
 
101
struct name {                                                           \
 
102
         struct type *lh_first; /* first element */                     \
 
103
}
 
104
 
 
105
#define LIST_ENTRY(type)                                                \
 
106
struct {                                                                \
 
107
         struct type *le_next;  /* next element */                      \
 
108
         struct type **le_prev; /* address of previous next element */  \
 
109
}
 
110
 
 
111
/*
 
112
 * List functions.
 
113
 */
 
114
 
 
115
#define LIST_EMPTY(head)        ((head)->lh_first == NULL)
 
116
 
 
117
#define LIST_FIRST(head)        ((head)->lh_first)
 
118
 
 
119
#define LIST_INIT(head) do {                                            \
 
120
         LIST_FIRST((head)) = NULL;                                     \
 
121
} while (0)
 
122
 
 
123
#define LIST_INSERT_HEAD(head, elm, field) do {                         \
 
124
         if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)    \
 
125
                 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
 
126
         LIST_FIRST((head)) = (elm);                                    \
 
127
         (elm)->field.le_prev = &LIST_FIRST((head));                    \
 
128
} while (0)
 
129
 
 
130
#define LIST_NEXT(elm, field)   ((elm)->field.le_next)
 
131
 
 
132
#define LIST_REMOVE(elm, field) do {                                    \
 
133
         if (LIST_NEXT((elm), field) != NULL)                           \
 
134
                 LIST_NEXT((elm), field)->field.le_prev =               \
 
135
                     (elm)->field.le_prev;                              \
 
136
         *(elm)->field.le_prev = LIST_NEXT((elm), field);               \
 
137
} while (0)