core_foundation_sys/
uuid.rs

1// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution.
3//
4// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7// option. This file may not be copied, modified, or distributed
8// except according to those terms.
9
10use std::os::raw::c_void;
11
12use crate::base::{CFAllocatorRef, CFTypeID};
13use crate::string::CFStringRef;
14
15#[repr(C)]
16pub struct __CFUUID(c_void);
17
18pub type CFUUIDRef = *const __CFUUID;
19
20#[repr(C)]
21#[derive(Debug, Clone, Copy, PartialEq, Default)]
22pub struct CFUUIDBytes {
23    pub byte0: u8,
24    pub byte1: u8,
25    pub byte2: u8,
26    pub byte3: u8,
27    pub byte4: u8,
28    pub byte5: u8,
29    pub byte6: u8,
30    pub byte7: u8,
31    pub byte8: u8,
32    pub byte9: u8,
33    pub byte10: u8,
34    pub byte11: u8,
35    pub byte12: u8,
36    pub byte13: u8,
37    pub byte14: u8,
38    pub byte15: u8,
39}
40
41extern "C" {
42    /*
43     * CFUUID.h
44     */
45
46    /* Creating CFUUID Objects */
47    pub fn CFUUIDCreate(allocator: CFAllocatorRef) -> CFUUIDRef;
48    pub fn CFUUIDCreateFromString(alloc: CFAllocatorRef, uuidStr: CFStringRef) -> CFUUIDRef;
49    pub fn CFUUIDCreateFromUUIDBytes(allocator: CFAllocatorRef, bytes: CFUUIDBytes) -> CFUUIDRef;
50    pub fn CFUUIDCreateWithBytes(
51        alloc: CFAllocatorRef,
52        byte0: u8,
53        byte1: u8,
54        byte2: u8,
55        byte3: u8,
56        byte4: u8,
57        byte5: u8,
58        byte6: u8,
59        byte7: u8,
60        byte8: u8,
61        byte9: u8,
62        byte10: u8,
63        byte11: u8,
64        byte12: u8,
65        byte13: u8,
66        byte14: u8,
67        byte15: u8,
68    ) -> CFUUIDRef;
69
70    /* Getting Information About CFUUID Objects */
71    pub fn CFUUIDCreateString(allocator: CFAllocatorRef, uid: CFUUIDRef) -> CFStringRef;
72    pub fn CFUUIDGetConstantUUIDWithBytes(
73        alloc: CFAllocatorRef,
74        byte0: u8,
75        byte1: u8,
76        byte2: u8,
77        byte3: u8,
78        byte4: u8,
79        byte5: u8,
80        byte6: u8,
81        byte7: u8,
82        byte8: u8,
83        byte9: u8,
84        byte10: u8,
85        byte11: u8,
86        byte12: u8,
87        byte13: u8,
88        byte14: u8,
89        byte15: u8,
90    ) -> CFUUIDRef;
91    pub fn CFUUIDGetUUIDBytes(uuid: CFUUIDRef) -> CFUUIDBytes;
92
93    /* Getting the CFUUID Type Identifier */
94    pub fn CFUUIDGetTypeID() -> CFTypeID;
95}