oss_xml.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #ifndef LIBOSS_XML_H
  2. #define LIBOSS_XML_H
  3. #include <mxml.h>
  4. #include "aos_string.h"
  5. #include "aos_transport.h"
  6. #include "aos_status.h"
  7. #include "oss_define.h"
  8. #include "oss_resumable.h"
  9. OSS_CPP_START
  10. /**
  11. * @brief functions for xml body parse
  12. **/
  13. int get_xmldoc(aos_list_t *bc, mxml_node_t **root);
  14. char *get_xmlnode_value(aos_pool_t *p, mxml_node_t * root, const char *xml_path);
  15. /**
  16. * @brief build xml body for complete_multipart_upload
  17. **/
  18. char *build_complete_multipart_upload_xml(aos_pool_t *p, aos_list_t *bc);
  19. /**
  20. * @brief build body for complete multipart upload
  21. **/
  22. void build_complete_multipart_upload_body(aos_pool_t *p, aos_list_t *part_list, aos_list_t *body);
  23. /**
  24. * @brief build xml body for put lifecycle
  25. **/
  26. char *build_lifecycle_xml(aos_pool_t *p, aos_list_t *lifecycle_rule_list);
  27. /**
  28. * @brief build body for put lifecycle
  29. **/
  30. void build_lifecycle_body(aos_pool_t *p, aos_list_t *lifecycle_rule_list, aos_list_t *body);
  31. /**
  32. * @brief build xml body for delete objects
  33. **/
  34. char *build_objects_xml(aos_pool_t *p, aos_list_t *object_list, const char *quiet);
  35. /**
  36. * @brief build body for delete objects
  37. **/
  38. void build_delete_objects_body(aos_pool_t *p, aos_list_t *object_list, int is_quiet,
  39. aos_list_t *body);
  40. mxml_node_t *set_xmlnode_value_str(mxml_node_t *parent, const char *name, const aos_string_t *value);
  41. mxml_node_t *set_xmlnode_value_int(mxml_node_t *parent, const char *name, int value);
  42. mxml_node_t *set_xmlnode_value_int64(mxml_node_t *parent, const char *name, int64_t value);
  43. int get_xmlnode_value_str(aos_pool_t *p, mxml_node_t *xml_node, const char *xml_path, aos_string_t *value);
  44. int get_xmlnode_value_int(aos_pool_t *p, mxml_node_t *xml_node, const char *xml_path, int *value);
  45. int get_xmlnode_value_int64(aos_pool_t *p, mxml_node_t *xml_node, const char *xml_path, int64_t *value);
  46. /**
  47. * @brief build xml for checkpoint
  48. **/
  49. char *oss_build_checkpoint_xml(aos_pool_t *p, const oss_checkpoint_t *checkpoint);
  50. /**
  51. * @bried parse checkpoint from xml
  52. **/
  53. int oss_checkpoint_parse_from_body(aos_pool_t *p, const char *xml_body, oss_checkpoint_t *checkpoint);
  54. /**
  55. * @bried parse acl from xml body for get_bucket_acl
  56. **/
  57. int oss_acl_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_string_t *oss_acl);
  58. /**
  59. * @brief parse upload_id from xml body for init multipart upload
  60. **/
  61. int oss_upload_id_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_string_t *upload_id);
  62. /**
  63. * @brief parse objects from xml body for list objects
  64. **/
  65. void oss_list_objects_owner_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_list_object_content_t *content);
  66. void oss_list_objects_content_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_list_object_content_t *content);
  67. void oss_list_objects_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  68. aos_list_t *object_list);
  69. void oss_list_objects_prefix_parse(aos_pool_t *p, mxml_node_t *root,
  70. oss_list_object_common_prefix_t *common_prefix);
  71. void oss_list_objects_common_prefix_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  72. aos_list_t *common_prefix_list);
  73. int oss_list_objects_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_list_t *object_list,
  74. aos_list_t *common_prefix_list, aos_string_t *marker, int *truncated);
  75. /**
  76. * @brief parse parts from xml body for list upload part
  77. **/
  78. void oss_list_parts_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  79. aos_list_t *part_list);
  80. void oss_list_parts_content_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_list_part_content_t *content);
  81. int oss_list_parts_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_list_t *part_list,
  82. aos_string_t *part_number_marker, int *truncated);
  83. /**
  84. * @brief parse uploads from xml body for list multipart upload
  85. **/
  86. void oss_list_multipart_uploads_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  87. aos_list_t *upload_list);
  88. void oss_list_multipart_uploads_content_parse(aos_pool_t *p, mxml_node_t *xml_node,
  89. oss_list_multipart_upload_content_t *content);
  90. int oss_list_multipart_uploads_parse_from_body(aos_pool_t *p, aos_list_t *bc,
  91. aos_list_t *upload_list, aos_string_t *key_marker,
  92. aos_string_t *upload_id_marker, int *truncated);
  93. /**
  94. * @brief parse lifecycle rules from xml body
  95. **/
  96. void oss_lifecycle_rule_expire_parse(aos_pool_t *p, mxml_node_t *xml_node,
  97. oss_lifecycle_rule_content_t *content);
  98. void oss_lifecycle_rule_content_parse(aos_pool_t *p, mxml_node_t *xml_node,
  99. oss_lifecycle_rule_content_t *content);
  100. void oss_lifecycle_rule_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  101. aos_list_t *lifecycle_rule_list);
  102. int oss_lifecycle_rules_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_list_t *lifecycle_rule_list);
  103. /**
  104. * @brief parse delete objects contents from xml body
  105. **/
  106. void oss_delete_objects_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  107. aos_list_t *object_list);
  108. void oss_object_key_parse(aos_pool_t *p, mxml_node_t * xml_node, oss_object_key_t *content);
  109. int oss_delete_objects_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_list_t *object_list);
  110. /**
  111. * @brief build body for create live channel
  112. **/
  113. char *build_create_live_channel_xml(aos_pool_t *p, oss_live_channel_configuration_t *config);
  114. void build_create_live_channel_body(aos_pool_t *p, oss_live_channel_configuration_t *config, aos_list_t *body);
  115. /**
  116. * @brief parse create live channel contents from xml body
  117. **/
  118. void oss_publish_url_parse(aos_pool_t *p, mxml_node_t *node, oss_live_channel_publish_url_t *content);
  119. void oss_play_url_parse(aos_pool_t *p, mxml_node_t *node, oss_live_channel_play_url_t *content);
  120. void oss_publish_urls_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  121. aos_list_t *publish_xml_list);
  122. void oss_play_urls_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  123. aos_list_t *play_xml_list);
  124. void oss_create_live_channel_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *publish_xml_path,
  125. aos_list_t *publish_url_list, const char *play_xml_path, aos_list_t *play_url_list);
  126. int oss_create_live_channel_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_list_t *publish_url_list,
  127. aos_list_t *play_url_list);
  128. /**
  129. * @brief parse live channel info content from xml body
  130. **/
  131. void oss_live_channel_info_target_content_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_live_channel_target_t *target);
  132. void oss_live_channel_info_content_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  133. oss_live_channel_configuration_t *info);
  134. int oss_live_channel_info_parse_from_body(aos_pool_t *p, aos_list_t *bc, oss_live_channel_configuration_t *info);
  135. /**
  136. * @brief parse live channel stat content from xml body
  137. **/
  138. void oss_live_channel_stat_video_content_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_video_stat_t *video_stat);
  139. void oss_live_channel_stat_audio_content_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_audio_stat_t *audio_stat);
  140. void oss_live_channel_stat_content_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path, oss_live_channel_stat_t *stat);
  141. int oss_live_channel_stat_parse_from_body(aos_pool_t *p, aos_list_t *bc, oss_live_channel_stat_t *stat);
  142. /**
  143. * @brief parse live channel from xml body for list list channel
  144. **/
  145. void oss_list_live_channel_content_parse(aos_pool_t *p, mxml_node_t *xml_node, oss_live_channel_content_t *content);
  146. void oss_list_live_channel_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  147. aos_list_t *live_channel_list);
  148. int oss_list_live_channel_parse_from_body(aos_pool_t *p, aos_list_t *bc,
  149. aos_list_t *live_channel_list, aos_string_t *next_marker, int *truncated);
  150. /**
  151. * @brief parse live channel history content from xml body
  152. **/
  153. void oss_live_channel_history_content_parse(aos_pool_t *p, mxml_node_t * xml_node, oss_live_record_content_t *content);
  154. void oss_live_channel_history_contents_parse(aos_pool_t *p, mxml_node_t *root, const char *xml_path,
  155. aos_list_t *live_record_list);
  156. int oss_live_channel_history_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_list_t *live_record_list);
  157. OSS_CPP_END
  158. #endif