You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					172 lines
				
				5.6 KiB
			
		
		
			
		
	
	
					172 lines
				
				5.6 KiB
			| 
								 
											6 years ago
										 
									 | 
							
								'\" t
							 | 
						||
| 
								 | 
							
								.\"     Title: zuuid
							 | 
						||
| 
								 | 
							
								.\"    Author: [see the "AUTHORS" section]
							 | 
						||
| 
								 | 
							
								.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
							 | 
						||
| 
								 | 
							
								.\"      Date: 12/31/2016
							 | 
						||
| 
								 | 
							
								.\"    Manual: CZMQ Manual
							 | 
						||
| 
								 | 
							
								.\"    Source: CZMQ 4.0.2
							 | 
						||
| 
								 | 
							
								.\"  Language: English
							 | 
						||
| 
								 | 
							
								.\"
							 | 
						||
| 
								 | 
							
								.TH "ZUUID" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual"
							 | 
						||
| 
								 | 
							
								.\" -----------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								.\" * Define some portability stuff
							 | 
						||
| 
								 | 
							
								.\" -----------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
							 | 
						||
| 
								 | 
							
								.\" http://bugs.debian.org/507673
							 | 
						||
| 
								 | 
							
								.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
							 | 
						||
| 
								 | 
							
								.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
							 | 
						||
| 
								 | 
							
								.ie \n(.g .ds Aq \(aq
							 | 
						||
| 
								 | 
							
								.el       .ds Aq '
							 | 
						||
| 
								 | 
							
								.\" -----------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								.\" * set default formatting
							 | 
						||
| 
								 | 
							
								.\" -----------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								.\" disable hyphenation
							 | 
						||
| 
								 | 
							
								.nh
							 | 
						||
| 
								 | 
							
								.\" disable justification (adjust text to left margin only)
							 | 
						||
| 
								 | 
							
								.ad l
							 | 
						||
| 
								 | 
							
								.\" -----------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								.\" * MAIN CONTENT STARTS HERE *
							 | 
						||
| 
								 | 
							
								.\" -----------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								.SH "NAME"
							 | 
						||
| 
								 | 
							
								zuuid \- UUID support class
							 | 
						||
| 
								 | 
							
								.SH "SYNOPSIS"
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								.nf
							 | 
						||
| 
								 | 
							
								//  This is a stable class, and may not change except for emergencies\&. It
							 | 
						||
| 
								 | 
							
								//  is provided in stable builds\&.
							 | 
						||
| 
								 | 
							
								//  Create a new UUID object\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT zuuid_t *
							 | 
						||
| 
								 | 
							
								    zuuid_new (void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Create UUID object from supplied ZUUID_LEN\-octet value\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT zuuid_t *
							 | 
						||
| 
								 | 
							
								    zuuid_new_from (const byte *source);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Destroy a specified UUID object\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT void
							 | 
						||
| 
								 | 
							
								    zuuid_destroy (zuuid_t **self_p);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Set UUID to new supplied ZUUID_LEN\-octet value\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT void
							 | 
						||
| 
								 | 
							
								    zuuid_set (zuuid_t *self, const byte *source);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Set UUID to new supplied string value skipping \*(Aq\-\*(Aq and \*(Aq{\*(Aq \*(Aq}\*(Aq
							 | 
						||
| 
								 | 
							
								//  optional delimiters\&. Return 0 if OK, else returns \-1\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT int
							 | 
						||
| 
								 | 
							
								    zuuid_set_str (zuuid_t *self, const char *source);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Return UUID binary data\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT const byte *
							 | 
						||
| 
								 | 
							
								    zuuid_data (zuuid_t *self);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Return UUID binary size
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT size_t
							 | 
						||
| 
								 | 
							
								    zuuid_size (zuuid_t *self);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Returns UUID as string
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT const char *
							 | 
						||
| 
								 | 
							
								    zuuid_str (zuuid_t *self);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Return UUID in the canonical string format: 8\-4\-4\-4\-12, in lower
							 | 
						||
| 
								 | 
							
								//  case\&. Caller does not modify or free returned value\&. See
							 | 
						||
| 
								 | 
							
								//  http://en\&.wikipedia\&.org/wiki/Universally_unique_identifier
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT const char *
							 | 
						||
| 
								 | 
							
								    zuuid_str_canonical (zuuid_t *self);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Store UUID blob in target array
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT void
							 | 
						||
| 
								 | 
							
								    zuuid_export (zuuid_t *self, byte *target);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Check if UUID is same as supplied value
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT bool
							 | 
						||
| 
								 | 
							
								    zuuid_eq (zuuid_t *self, const byte *compare);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Check if UUID is different from supplied value
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT bool
							 | 
						||
| 
								 | 
							
								    zuuid_neq (zuuid_t *self, const byte *compare);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Make copy of UUID object; if uuid is null, or memory was exhausted,
							 | 
						||
| 
								 | 
							
								//  returns null\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT zuuid_t *
							 | 
						||
| 
								 | 
							
								    zuuid_dup (zuuid_t *self);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Self test of this class\&.
							 | 
						||
| 
								 | 
							
								CZMQ_EXPORT void
							 | 
						||
| 
								 | 
							
								    zuuid_test (bool verbose);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zuuid\&.c\*(Aq\&.
							 | 
						||
| 
								 | 
							
								.fi
							 | 
						||
| 
								 | 
							
								.SH "DESCRIPTION"
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								The zuuid class generates UUIDs and provides methods for working with them\&. If you build CZMQ with libuuid, on Unix/Linux, it will use that library\&. On Windows it will use UuidCreate()\&. Otherwise it will use a random number generator to produce convincing imitations of UUIDs\&.
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zuuid\&.c\fR\&.
							 | 
						||
| 
								 | 
							
								.SH "EXAMPLE"
							 | 
						||
| 
								 | 
							
								.PP
							 | 
						||
| 
								 | 
							
								\fBFrom zuuid_test method\fR. 
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								.if n \{\
							 | 
						||
| 
								 | 
							
								.RS 4
							 | 
						||
| 
								 | 
							
								.\}
							 | 
						||
| 
								 | 
							
								.nf
							 | 
						||
| 
								 | 
							
								//  Simple create/destroy test
							 | 
						||
| 
								 | 
							
								assert (ZUUID_LEN == 16);
							 | 
						||
| 
								 | 
							
								assert (ZUUID_STR_LEN == 32);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								zuuid_t *uuid = zuuid_new ();
							 | 
						||
| 
								 | 
							
								assert (uuid);
							 | 
						||
| 
								 | 
							
								assert (zuuid_size (uuid) == ZUUID_LEN);
							 | 
						||
| 
								 | 
							
								assert (strlen (zuuid_str (uuid)) == ZUUID_STR_LEN);
							 | 
						||
| 
								 | 
							
								zuuid_t *copy = zuuid_dup (uuid);
							 | 
						||
| 
								 | 
							
								assert (streq (zuuid_str (uuid), zuuid_str (copy)));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Check set/set_str/export methods
							 | 
						||
| 
								 | 
							
								const char *myuuid = "8CB3E9A9649B4BEF8DE225E9C2CEBB38";
							 | 
						||
| 
								 | 
							
								const char *myuuid2 = "8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38";
							 | 
						||
| 
								 | 
							
								const char *myuuid3 = "{8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38}";
							 | 
						||
| 
								 | 
							
								const char *myuuid4 = "8CB3E9A9649B4BEF8DE225E9C2CEBB3838";
							 | 
						||
| 
								 | 
							
								int rc = zuuid_set_str (uuid, myuuid);
							 | 
						||
| 
								 | 
							
								assert (rc == 0);
							 | 
						||
| 
								 | 
							
								assert (streq (zuuid_str (uuid), myuuid));
							 | 
						||
| 
								 | 
							
								rc = zuuid_set_str (uuid, myuuid2);
							 | 
						||
| 
								 | 
							
								assert (rc == 0);
							 | 
						||
| 
								 | 
							
								assert (streq (zuuid_str (uuid), myuuid));
							 | 
						||
| 
								 | 
							
								rc = zuuid_set_str (uuid, myuuid3);
							 | 
						||
| 
								 | 
							
								assert (rc == 0);
							 | 
						||
| 
								 | 
							
								assert (streq (zuuid_str (uuid), myuuid));
							 | 
						||
| 
								 | 
							
								rc = zuuid_set_str (uuid, myuuid4);
							 | 
						||
| 
								 | 
							
								assert (rc == \-1);
							 | 
						||
| 
								 | 
							
								byte copy_uuid [ZUUID_LEN];
							 | 
						||
| 
								 | 
							
								zuuid_export (uuid, copy_uuid);
							 | 
						||
| 
								 | 
							
								zuuid_set (uuid, copy_uuid);
							 | 
						||
| 
								 | 
							
								assert (streq (zuuid_str (uuid), myuuid));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//  Check the canonical string format
							 | 
						||
| 
								 | 
							
								assert (streq (zuuid_str_canonical (uuid),
							 | 
						||
| 
								 | 
							
								               "8cb3e9a9\-649b\-4bef\-8de2\-25e9c2cebb38"));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								zuuid_destroy (&uuid);
							 | 
						||
| 
								 | 
							
								zuuid_destroy (©);
							 | 
						||
| 
								 | 
							
								.fi
							 | 
						||
| 
								 | 
							
								.if n \{\
							 | 
						||
| 
								 | 
							
								.RE
							 | 
						||
| 
								 | 
							
								.\}
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								.SH "AUTHORS"
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								The czmq manual was written by the authors in the AUTHORS file\&.
							 | 
						||
| 
								 | 
							
								.SH "RESOURCES"
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								Main web site: \m[blue]\fB\%\fR\m[]
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2>
							 | 
						||
| 
								 | 
							
								.SH "COPYRIGHT"
							 | 
						||
| 
								 | 
							
								.sp
							 | 
						||
| 
								 | 
							
								Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&.
							 | 
						||
| 
								 | 
							
								.SH "NOTES"
							 | 
						||
| 
								 | 
							
								.IP " 1." 4
							 | 
						||
| 
								 | 
							
								zeromq-dev@lists.zeromq.org
							 | 
						||
| 
								 | 
							
								.RS 4
							 | 
						||
| 
								 | 
							
								\%mailto:zeromq-dev@lists.zeromq.org
							 | 
						||
| 
								 | 
							
								.RE
							 |