dialog_info.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. /*
  2. * Copyright (C) 2024 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2013 Maxim Kondratenko <max.kondr@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJSIP_SIMPLE_DIALOG_INFO_H__
  20. #define __PJSIP_SIMPLE_DIALOG_INFO_H__
  21. /**
  22. * @file dialog_info.h
  23. * @brief Dialog-Info Information Data Format (RFC 4235)
  24. */
  25. #include <pjsip-simple/types.h>
  26. #include <pjlib-util/xml.h>
  27. PJ_BEGIN_DECL
  28. /**
  29. * @defgroup PJSIP_SIMPLE_DIALOG_INFO Dialog-Info Data Format (RFC 4235)
  30. * @ingroup PJSIP_SIMPLE
  31. * @brief Support for Dialog-Info Information Data Format (RFC 4235)
  32. * @{
  33. *
  34. * This file provides tools for manipulating Dialog-Info Information Data
  35. * Format as described in RFC 4235.
  36. */
  37. typedef struct pj_xml_node pjsip_dlg_info_dialog_info;
  38. typedef struct pj_xml_node pjsip_dlg_info_dialog;
  39. typedef struct pj_xml_node pjsip_dlg_info_local;
  40. typedef struct pj_xml_node pjsip_dlg_info_remote;
  41. typedef struct pjsip_dlg_info_local_op
  42. {
  43. void (*construct)(pj_pool_t *, pjsip_dlg_info_local *);
  44. const pj_str_t * (*get_identity)(const pjsip_dlg_info_local *);
  45. void (*set_identity)(pj_pool_t *pool, const pjsip_dlg_info_local *,
  46. const pj_str_t *);
  47. const pj_str_t * (*get_identity_display)(const pjsip_dlg_info_local*);
  48. void (*set_identity_display)(pj_pool_t *pool, const pjsip_dlg_info_local *,
  49. const pj_str_t *);
  50. const pj_str_t * (*get_target_uri)(const pjsip_dlg_info_local*);
  51. void (*set_target_uri)(pj_pool_t *pool, const pjsip_dlg_info_local *,
  52. const pj_str_t *);
  53. } pjsip_dlg_info_local_op;
  54. typedef struct pjsip_dlg_info_remote_op
  55. {
  56. void (*construct)(pj_pool_t *, pjsip_dlg_info_remote *);
  57. const pj_str_t * (*get_identity)(const pjsip_dlg_info_remote *);
  58. void (*set_identity)(pj_pool_t *pool, const pjsip_dlg_info_remote *,
  59. const pj_str_t *);
  60. const pj_str_t * (*get_identity_display)(const pjsip_dlg_info_remote*);
  61. void (*set_identity_display)(pj_pool_t *pool, const pjsip_dlg_info_remote*,
  62. const pj_str_t *);
  63. const pj_str_t * (*get_target_uri)(const pjsip_dlg_info_remote*);
  64. void (*set_target_uri)(pj_pool_t *pool, const pjsip_dlg_info_remote *,
  65. const pj_str_t *);
  66. } pjsip_dlg_info_remote_op;
  67. typedef struct pjsip_dlg_info_dialog_op
  68. {
  69. void (*construct)(pj_pool_t *, pjsip_dlg_info_dialog *, const pj_str_t *);
  70. const pj_str_t * (*get_id)(const pjsip_dlg_info_dialog *);
  71. void (*set_id)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  72. const pj_str_t *);
  73. const pj_str_t * (*get_call_id)(const pjsip_dlg_info_dialog *);
  74. void (*set_call_id)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  75. const pj_str_t *);
  76. const pj_str_t * (*get_remote_tag)(const pjsip_dlg_info_dialog *);
  77. void (*set_remote_tag)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  78. const pj_str_t *);
  79. const pj_str_t * (*get_local_tag)(const pjsip_dlg_info_dialog *);
  80. void (*set_local_tag)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  81. const pj_str_t *);
  82. const pj_str_t * (*get_direction)(const pjsip_dlg_info_dialog *);
  83. void (*set_direction)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  84. const pj_str_t *);
  85. const pj_str_t * (*get_state)(const pjsip_dlg_info_dialog *);
  86. void (*set_state)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  87. const pj_str_t *);
  88. const pj_str_t * (*get_duration)(const pjsip_dlg_info_dialog *);
  89. void (*set_duration)(pj_pool_t *pool, const pjsip_dlg_info_dialog *,
  90. const pj_str_t *);
  91. pjsip_dlg_info_local* (*get_local)(const pjsip_dlg_info_dialog *);
  92. pjsip_dlg_info_local* (*set_local)(pj_pool_t *pool,
  93. const pjsip_dlg_info_dialog *,
  94. const pjsip_dlg_info_local *);
  95. pjsip_dlg_info_remote* (*get_remote)(const pjsip_dlg_info_dialog *);
  96. pjsip_dlg_info_remote* (*set_remote)(pj_pool_t *pool,
  97. const pjsip_dlg_info_dialog *,
  98. const pjsip_dlg_info_remote *);
  99. } pjsip_dlg_info_dialog_op;
  100. typedef struct pjsip_dlg_info_dialog_info_op
  101. {
  102. void (*construct)(pj_pool_t *, pjsip_dlg_info_dialog_info *,
  103. const pj_str_t *, const pj_str_t *, const pj_str_t *);
  104. const pj_str_t * (*get_state)(const pjsip_dlg_info_dialog_info *);
  105. void (*set_state)(pj_pool_t *pool, const pjsip_dlg_info_dialog_info *,
  106. const pj_str_t *);
  107. const pj_str_t * (*get_version)(const pjsip_dlg_info_dialog_info *);
  108. void (*set_version)(pj_pool_t *pool, const pjsip_dlg_info_dialog_info *,
  109. const pj_str_t *);
  110. const pj_str_t * (*get_entity)(const pjsip_dlg_info_dialog_info *);
  111. void (*set_entity)(pj_pool_t *pool, const pjsip_dlg_info_dialog_info *,
  112. const pj_str_t *);
  113. pjsip_dlg_info_dialog* (*get_dialog)(const pjsip_dlg_info_dialog_info *);
  114. void (*set_dialog)(pj_pool_t *pool, const pjsip_dlg_info_dialog_info *,
  115. const pjsip_dlg_info_dialog * );
  116. } pjsip_dlg_info_dialog_info_op;
  117. /******************************************************************************
  118. * Top level API for managing dialog-info document.
  119. *****************************************************************************/
  120. PJ_DECL(pjsip_dlg_info_dialog_info *)
  121. pjsip_dlg_info_create(pj_pool_t *pool, const pj_str_t *version,
  122. const pj_str_t *state, const pj_str_t *entity);
  123. PJ_DECL(pjsip_dlg_info_dialog_info *)
  124. pjsip_dlg_info_parse(pj_pool_t *pool, char *text, int len);
  125. PJ_DECL(int)
  126. pjsip_dlg_info_print(const pjsip_dlg_info_dialog_info *dialog_info,
  127. char *buf, int len);
  128. /******************************************************************************
  129. * API for managing Dialog-info node.
  130. *****************************************************************************/
  131. PJ_DECL(void)
  132. pjsip_dlg_info_dialog_info_construct(pj_pool_t *pool,
  133. pjsip_dlg_info_dialog_info *dialog_info,
  134. const pj_str_t *version,
  135. const pj_str_t *state,
  136. const pj_str_t *entity);
  137. PJ_DECL(const pj_str_t *)
  138. pjsip_dlg_info_dialog_info_get_state(pjsip_dlg_info_dialog_info *dialog_info);
  139. PJ_DECL(void)
  140. pjsip_dlg_info_dialog_info_set_state(pj_pool_t *pool,
  141. pjsip_dlg_info_dialog_info *dialog_info,
  142. const pj_str_t *state);
  143. PJ_DECL(const pj_str_t *)
  144. pjsip_dlg_info_dialog_info_get_version(pjsip_dlg_info_dialog_info *dlg_info);
  145. PJ_DECL(void)
  146. pjsip_dlg_info_dialog_info_set_version(pj_pool_t *pool,
  147. pjsip_dlg_info_dialog_info *dialog_info,
  148. const pj_str_t *version);
  149. PJ_DECL(const pj_str_t *)
  150. pjsip_dlg_info_dialog_info_get_entity(pjsip_dlg_info_dialog_info *dialog_info);
  151. PJ_DECL(void)
  152. pjsip_dlg_info_dialog_info_set_entity(pj_pool_t *pool,
  153. pjsip_dlg_info_dialog_info *dialog_info,
  154. const pj_str_t *entity);
  155. PJ_DECL(pjsip_dlg_info_dialog *)
  156. pjsip_dlg_info_dialog_info_add_dialog(pj_pool_t *pool,
  157. pjsip_dlg_info_dialog_info *dialog_info,
  158. const pj_str_t *id);
  159. PJ_DECL(pjsip_dlg_info_dialog *)
  160. pjsip_dlg_info_dialog_info_get_dialog(pjsip_dlg_info_dialog_info *dialog_info);
  161. /******************************************************************************
  162. * API for managing Dialog node.
  163. *****************************************************************************/
  164. PJ_DECL(void)
  165. pjsip_dlg_info_dialog_construct(pj_pool_t *pool,
  166. pjsip_dlg_info_dialog *dialog,
  167. const pj_str_t *id);
  168. PJ_DECL(const pj_str_t *)
  169. pjsip_dlg_info_dialog_get_id(const pjsip_dlg_info_dialog *dialog);
  170. PJ_DECL(void)
  171. pjsip_dlg_info_dialog_set_id(pj_pool_t *pool,
  172. pjsip_dlg_info_dialog *dialog,
  173. const pj_str_t *id);
  174. PJ_DECL(const pj_str_t *)
  175. pjsip_dlg_info_dialog_get_call_id(const pjsip_dlg_info_dialog *dialog);
  176. PJ_DECL(void)
  177. pjsip_dlg_info_dialog_set_call_id(pj_pool_t *pool,
  178. pjsip_dlg_info_dialog *dialog,
  179. const pj_str_t *call_id);
  180. PJ_DECL(const pj_str_t *)
  181. pjsip_dlg_info_dialog_get_remote_tag(const pjsip_dlg_info_dialog *dialog);
  182. PJ_DECL(void)
  183. pjsip_dlg_info_dialog_set_remote_tag(pj_pool_t *pool,
  184. pjsip_dlg_info_dialog *dialog,
  185. const pj_str_t *remote_tag);
  186. PJ_DECL(const pj_str_t *)
  187. pjsip_dlg_info_dialog_get_local_tag(const pjsip_dlg_info_dialog *dialog);
  188. PJ_DECL(void)
  189. pjsip_dlg_info_dialog_set_local_tag(pj_pool_t *pool,
  190. pjsip_dlg_info_dialog *dialog,
  191. const pj_str_t *local_tag);
  192. PJ_DECL(const pj_str_t *)
  193. pjsip_dlg_info_dialog_get_direction(const pjsip_dlg_info_dialog *dialog);
  194. PJ_DECL(void)
  195. pjsip_dlg_info_dialog_set_direction(pj_pool_t *pool,
  196. pjsip_dlg_info_dialog *dialog,
  197. const pj_str_t *direction);
  198. PJ_DECL(const pj_str_t *)
  199. pjsip_dlg_info_dialog_get_state(pjsip_dlg_info_dialog *dialog);
  200. PJ_DECL(void)
  201. pjsip_dlg_info_dialog_set_state(pj_pool_t *pool,
  202. pjsip_dlg_info_dialog *dialog,
  203. const pj_str_t *state);
  204. PJ_DECL(const pj_str_t *)
  205. pjsip_dlg_info_dialog_get_duration(pjsip_dlg_info_dialog *dialog);
  206. PJ_DECL(void)
  207. pjsip_dlg_info_dialog_set_duration(pj_pool_t *pool,
  208. pjsip_dlg_info_dialog *dialog,
  209. const pj_str_t *duration);
  210. PJ_DECL(pjsip_dlg_info_local *)
  211. pjsip_dlg_info_dialog_get_local(pjsip_dlg_info_dialog *dialog);
  212. PJ_DECL(pjsip_dlg_info_local *)
  213. pjsip_dlg_info_dialog_add_local(pj_pool_t *pool,
  214. pjsip_dlg_info_dialog *dialog);
  215. PJ_DECL(pjsip_dlg_info_remote *)
  216. pjsip_dlg_info_dialog_get_remote(pjsip_dlg_info_dialog *dialog);
  217. PJ_DECL(pjsip_dlg_info_remote *)
  218. pjsip_dlg_info_dialog_add_remote(pj_pool_t *pool,
  219. pjsip_dlg_info_dialog *dialog);
  220. /******************************************************************************
  221. * API for managing Local node.
  222. *****************************************************************************/
  223. PJ_DECL(void)
  224. pjsip_dlg_info_local_construct(pj_pool_t *pool,
  225. pjsip_dlg_info_local *local);
  226. PJ_DECL(const pj_str_t *)
  227. pjsip_dlg_info_local_get_identity(const pjsip_dlg_info_local *local);
  228. PJ_DECL(void)
  229. pjsip_dlg_info_local_add_identity(pj_pool_t *pool,
  230. pjsip_dlg_info_local *local,
  231. const pj_str_t *identity);
  232. PJ_DECL(const pj_str_t *)
  233. pjsip_dlg_info_local_get_identity_display(const pjsip_dlg_info_local *local);
  234. PJ_DECL(void)
  235. pjsip_dlg_info_local_set_identity_display(pj_pool_t *pool,
  236. pjsip_dlg_info_local *local,
  237. const pj_str_t *identity_display);
  238. PJ_DECL(const pj_str_t *)
  239. pjsip_dlg_info_local_get_target_uri(const pjsip_dlg_info_local *local);
  240. PJ_DECL(void)
  241. pjsip_dlg_info_local_set_target_uri(pj_pool_t *pool,
  242. pjsip_dlg_info_local *local,
  243. const pj_str_t *target_uri);
  244. /******************************************************************************
  245. * API for managing Remote node.
  246. *****************************************************************************/
  247. PJ_DECL(void)
  248. pjsip_dlg_info_remote_construct(pj_pool_t *pool,
  249. pjsip_dlg_info_remote *remote);
  250. PJ_DECL(const pj_str_t *)
  251. pjsip_dlg_info_remote_get_identity(const pjsip_dlg_info_remote *remote);
  252. PJ_DECL(void)
  253. pjsip_dlg_info_remote_add_identity(pj_pool_t *pool,
  254. pjsip_dlg_info_remote *remote,
  255. const pj_str_t *identity);
  256. PJ_DECL(const pj_str_t *)
  257. pjsip_dlg_info_remote_get_identity_display(const pjsip_dlg_info_remote *remote);
  258. PJ_DECL(void)
  259. pjsip_dlg_info_remote_set_identity_display(pj_pool_t *pool,
  260. pjsip_dlg_info_remote *remote,
  261. const pj_str_t *identity_display);
  262. PJ_DECL(const pj_str_t *)
  263. pjsip_dlg_info_remote_get_target_uri(const pjsip_dlg_info_remote *remote);
  264. PJ_DECL(void)
  265. pjsip_dlg_info_remote_set_target_uri(pj_pool_t *pool,
  266. pjsip_dlg_info_remote *remote,
  267. const pj_str_t *target_uri);
  268. PJ_END_DECL
  269. #endif /* __PJSIP_SIMPLE_DIALOG_INFO_H__ */