]> git.somenet.org - irc/bugbot.git/blob - uuidgen/token.h
some old base
[irc/bugbot.git] / uuidgen / token.h
1 /*
2 ** Copyright (C) 1998-1999 Greg Stein. All Rights Reserved.
3 **
4 ** By using this file, you agree to the terms and conditions set forth in
5 ** the LICENSE.html file which can be found at the top level of the mod_dav
6 ** distribution or at http://www.webdav.org/mod_dav/license-1.html.
7 **
8 ** Contact information:
9 **   Greg Stein, PO Box 3151, Redmond, WA, 98073
10 **   gstein@lyra.org, http://www.webdav.org/mod_dav/
11 */
12
13 /*
14 ** DAV opaquelocktoken scheme implementation
15 **
16 ** Written 5/99 by Keith Wannamaker, wannamak@us.ibm.com
17 ** Adapted from ISO/DCE RPC spec and a former Internet Draft
18 ** by Leach and Salz:
19 ** http://www.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uuids-guids-01
20 **
21 ** Portions of the code are covered by the following license:
22 **
23 ** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
24 ** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
25 ** Digital Equipment Corporation, Maynard, Mass.
26 ** Copyright (c) 1998 Microsoft.
27 ** To anyone who acknowledges that this file is provided "AS IS"
28 ** without any express or implied warranty: permission to use, copy,
29 ** modify, and distribute this file for any purpose is hereby
30 ** granted without fee, provided that the above copyright notices and
31 ** this notice appears in all source code copies, and that none of
32 ** the names of Open Software Foundation, Inc., Hewlett-Packard
33 ** Company, or Digital Equipment Corporation be used in advertising
34 ** or publicity pertaining to distribution of the software without
35 ** specific, written prior permission.  Neither Open Software
36 ** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
37 ** Corporation makes any representations about the suitability of
38 ** this software for any purpose.
39 */
40
41 #ifndef _TOKEN_H_
42 #define _TOKEN_H_
43
44 typedef unsigned long   unsigned32;
45 typedef unsigned short  unsigned16;
46 typedef unsigned char   unsigned8;
47
48 typedef struct {
49     char nodeID[6];
50 } uuid_node_t;
51
52 #undef uuid_t
53
54 typedef struct _uuid_t
55 {
56     unsigned32  time_low;
57     unsigned16  time_mid;
58     unsigned16  time_hi_and_version;
59     unsigned8   clock_seq_hi_and_reserved;
60     unsigned8   clock_seq_low;
61     unsigned8   node[6];
62 } uuid_t;
63
64 /* data type for UUID generator persistent state */
65         
66 typedef struct {
67     uuid_node_t node;     /* saved node ID */
68     unsigned16 cs;        /* saved clock sequence */
69 } uuid_state;
70
71 extern const uuid_t null_locktoken;
72
73 /* in dav_opaquelock.c */
74 int create_token(uuid_state *st, uuid_t *u);
75 void create_uuid_state(uuid_state *st);
76 void format_token(char *target, const uuid_t *u);
77 int compare_token(const uuid_t a, const uuid_t b);
78 int parse_token(const char *char_token, uuid_t *bin_token);
79
80 #endif /* _TOKEN_H_ */