config_center_client.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright [2021] JD.com, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * 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. #ifndef APP_CLIENT_SET_H_INCLUDED_
  18. #define APP_CLIENT_SET_H_INCLUDED_
  19. #include <stdio.h>
  20. #include <stdint.h>
  21. #include <stdlib.h>
  22. #include <stdbool.h>
  23. #include <memory.h>
  24. #define FORWARD_SHM_KEY 213576
  25. #define MASTER_SHM_KEY 214578
  26. #define SLAVE_SHM_KEY 215579
  27. #define DEFAULT_BID_NUM 1000
  28. enum { BEGIN = 10000,
  29. NULL_PTR,
  30. GET_SHM_ERR,
  31. DETACH_SHM_ERR,
  32. NOT_FIND_BID,
  33. OFFSET_ERR,
  34. IP_NUM_ERR,
  35. PARAM_ERR,
  36. END,
  37. };
  38. typedef struct node_header {
  39. int bid;
  40. int size;
  41. int offset;
  42. } NODE_HEADER;
  43. typedef struct forward_item {
  44. int lock;
  45. int shm_key;
  46. int bid_size;
  47. int node_size;
  48. int forward_shm_id;
  49. int master_shm_id;
  50. int slave_shm_id;
  51. unsigned int shm_size;
  52. uint64_t time_stamp;
  53. NODE_HEADER headers[DEFAULT_BID_NUM];
  54. } FORWARD_ITEM;
  55. #endif