apr_uuid.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @file apr_uuid.h
  18. * @brief APR UUID library
  19. */
  20. #ifndef APR_UUID_H
  21. #define APR_UUID_H
  22. #include "apu.h"
  23. #include "apr_errno.h"
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif /* __cplusplus */
  27. /**
  28. * @defgroup APR_UUID UUID Handling
  29. * @ingroup APR
  30. * @{
  31. */
  32. /**
  33. * we represent a UUID as a block of 16 bytes.
  34. */
  35. typedef struct {
  36. unsigned char data[16]; /**< the actual UUID */
  37. } apr_uuid_t;
  38. /** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */
  39. #define APR_UUID_FORMATTED_LENGTH 36
  40. /**
  41. * Generate and return a (new) UUID
  42. * @param uuid The resulting UUID
  43. */
  44. APU_DECLARE(void) apr_uuid_get(apr_uuid_t *uuid);
  45. /**
  46. * Format a UUID into a string, following the standard format
  47. * @param buffer The buffer to place the formatted UUID string into. It must
  48. * be at least APR_UUID_FORMATTED_LENGTH + 1 bytes long to hold
  49. * the formatted UUID and a null terminator
  50. * @param uuid The UUID to format
  51. */
  52. APU_DECLARE(void) apr_uuid_format(char *buffer, const apr_uuid_t *uuid);
  53. /**
  54. * Parse a standard-format string into a UUID
  55. * @param uuid The resulting UUID
  56. * @param uuid_str The formatted UUID
  57. */
  58. APU_DECLARE(apr_status_t) apr_uuid_parse(apr_uuid_t *uuid, const char *uuid_str);
  59. /** @} */
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* APR_UUID_H */