2 // Copyright (C) 2008 Francesco Salvestrini
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this program; if not, write to the Free Software Foundation, Inc.,
16 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef LIBS_NET_UUID_H
20 #define LIBS_NET_UUID_H
31 UUID(const std::string
& u
);
36 operator std::string(void);
37 bool operator ==(const UUID
& rhs
);
38 UUID
& operator =(const UUID
& rhs
);
39 friend std::ostream
& operator <<(std::ostream
& stream
,
41 friend std::istream
& operator >>(std::istream
& stream
,
46 IETF_RFC4122_TIMEBASED
= 1,
47 DCE_SECURITY_POSIX_UID
= 2,
48 IETF_RFC4122_NAMEBASED_MD5
= 3,
49 IETF_RFC4122_RANDOM
= 4,
50 IETF_RFC4122_NAMEBASED_SHA1
= 5
58 // The fields are encoded as 16 octets, with the sizes and order of the
59 // fields defined above, and with each field encoded with the Most
60 // Significant Byte first (known as network byte order). Note that the
61 // field names, particularly for multiplexed fields, follow historical
65 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
66 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
68 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69 // | time_mid | time_hi_and_version |
70 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71 // |clk_seq_hi_res | clk_seq_low | node (0-1) |
72 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
74 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
79 uint16_t time_hi_and_version
;
84 bool grab_4hex(const std::string
& u
,
85 std::string::size_type s
,
86 std::string::size_type e
,
88 bool grab_8hex(const std::string
& u
,
89 std::string::size_type s
,
90 std::string::size_type e
,
92 bool grab_12hex(const std::string
& u
,
93 std::string::size_type s
,
94 std::string::size_type e
,
99 #endif // LIBS_NET_UUID_H