Loading...
Searching...
No Matches
su_uniqueid.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_UNIQUEID_H
#define SU_UNIQUEID_H
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
#endif
SOFIA_BEGIN_DECLS
typedef union GloballyUniqueIdentifier {
unsigned char id[16];
struct {
uint32_t time_low;
uint16_t time_mid;
uint16_t time_high_and_version;
uint8_t clock_seq_hi_and_reserved;
uint8_t clock_seq_low;
uint8_t node[6];
} s;
} su_guid_t;
SOFIAPUBFUN size_t su_node_identifier(void *address, size_t addrlen);
SOFIAPUBFUN void su_guid_generate(su_guid_t *guid);
SOFIAPUBFUN isize_t su_guid_sprintf(char* buf, size_t len, su_guid_t const *guid);
enum {
su_guid_strlen = 8 + 5 + 5 + 5 + 13
};
SOFIAPUBFUN int su_randint(int lb, int ub);
SOFIAPUBFUN void *su_randmem(void *mem, size_t siz);
SOFIAPUBFUN uint32_t su_random(void);
SOFIAPUBFUN uint64_t su_random64(void);
SOFIA_END_DECLS
#endif
SOFIAPUBFUN
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition su_config.h:66
su_types.h
Basic integer types for su library.
uint32_t
SU_U32_T uint32_t
32-bit unsigned integer
Definition su_types.h:87
uint16_t
SU_U16_T uint16_t
16-bit unsigned integer
Definition su_types.h:91
uint64_t
SU_U64_T uint64_t
64-bit unsigned integer
Definition su_types.h:83
uint8_t
SU_U8_T uint8_t
8-bit unsigned integer
Definition su_types.h:95
su_guid_strlen
@ su_guid_strlen
Length of guid in hex format.
Definition su_uniqueid.h:94
su_guid_t
union GloballyUniqueIdentifier su_guid_t
Globally unique identifier type.
su_guid_sprintf
isize_t su_guid_sprintf(char *buf, size_t len, su_guid_t const *guid)
Print guid.
Definition su_uniqueid.c:341
su_random
uint32_t su_random(void)
Generate a random 32-bit unsigned integer.
Definition su_uniqueid.c:421
su_randint
int su_randint(int lb, int ub)
Random integer in range [lb, ub] (inclusive).
Definition su_uniqueid.c:401
su_randmem
void * su_randmem(void *mem, size_t siz)
Fill memory with random values.
Definition su_uniqueid.c:372
su_random64
uint64_t su_random64(void)
Generate a random 64-bit unsigned integer.
Definition su_uniqueid.c:357
su_node_identifier
size_t su_node_identifier(void *address, size_t addrlen)
Return node identifier.
Definition su_uniqueid.c:263
su_guid_generate
void su_guid_generate(su_guid_t *guid)
Generate a GUID.
Definition su_uniqueid.c:274
GloballyUniqueIdentifier
Globally unique identifier type.
Definition su_uniqueid.h:48

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.