client_id.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef HADOOP_CORE_RPC_CLIENT_ID
  19. #define HADOOP_CORE_RPC_CLIENT_ID
  20. #include <stddef.h> // for size_t
  21. #include <stdint.h> // for uint8_t
  22. #define HRPC_CLIENT_ID_LEN 16
  23. #define HRPC_CLIENT_ID_STR_LEN 36
  24. struct hrpc_client_id {
  25. uint8_t buf[HRPC_CLIENT_ID_LEN];
  26. };
  27. void hrpc_client_id_generate_rand(struct hrpc_client_id *id);
  28. struct hadoop_err *hrpc_client_id_from_bytes(void *bytes, int len,
  29. struct hrpc_client_id *out);
  30. const char *hrpc_client_id_to_str(const struct hrpc_client_id *id,
  31. char *str, size_t str_len);
  32. int hrpc_client_id_compare(const struct hrpc_client_id *a,
  33. const struct hrpc_client_id *b);
  34. #endif
  35. // vim: ts=4:sw=4:tw=79:et