api.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  4. <section id="usrloc.api" xmlns:xi="http://www.w3.org/2001/XInclude">
  5. <sectioninfo>
  6. </sectioninfo>
  7. <title>Usrloc Module API</title>
  8. <section id="ul_register_domain">
  9. <title>
  10. <function>ul_register_domain(name)</function>
  11. </title>
  12. <para>
  13. The function registers a new domain. Domain is just another name
  14. for table used in registrar. The function is called from fixups in
  15. registrar. It gets name of the domain as a parameter and returns
  16. pointer to a new domain structure. The fixup than 'fixes' the
  17. parameter in registrar so that it will pass the pointer instead of
  18. the name every time save() or lookup() is called. Some usrloc
  19. functions get the pointer as parameter when called. For more
  20. details see implementation of save function in registrar.
  21. </para>
  22. <para>Meaning of the parameters is as follows:</para>
  23. <itemizedlist>
  24. <listitem>
  25. <para><emphasis>const char* name</emphasis> - Name of the domain (also called
  26. table) to be registered.
  27. </para>
  28. </listitem>
  29. </itemizedlist>
  30. </section>
  31. <section id="ul_insert_urecord">
  32. <title>
  33. <function>ul_insert_urecord(domain, aor, rec)</function>
  34. </title>
  35. <para>
  36. The function creates a new record structure and inserts it in the
  37. specified domain. The record is structure that contains all the
  38. contacts for belonging to the specified username.
  39. </para>
  40. <para>Meaning of the parameters is as follows:</para>
  41. <itemizedlist>
  42. <listitem>
  43. <para>
  44. <emphasis>udomain_t* domain</emphasis> - Pointer to domain
  45. returned by ul_register_udomain.
  46. </para>
  47. </listitem>
  48. </itemizedlist>
  49. <itemizedlist>
  50. <listitem>
  51. <para>
  52. <emphasis>str* aor</emphasis> - Address of Record (aka
  53. username) of the new record (at this time the record will
  54. contain no contacts yet).
  55. </para>
  56. </listitem>
  57. </itemizedlist>
  58. <itemizedlist>
  59. <listitem>
  60. <para>
  61. <emphasis>urecord_t** rec</emphasis> - The newly created
  62. record structure.
  63. </para>
  64. </listitem>
  65. </itemizedlist>
  66. </section>
  67. <section id="ul_delete_urecord">
  68. <title>
  69. <function>ul_delete_urecord(domain, aor)</function>
  70. </title>
  71. <para>
  72. The function deletes all the contacts bound with the given Address
  73. Of Record.
  74. </para>
  75. <para>Meaning of the parameters is as follows:</para>
  76. <itemizedlist>
  77. <listitem>
  78. <para>
  79. <emphasis>udomain_t* domain</emphasis> - Pointer to domain returned by ul_register_udomain.
  80. </para>
  81. </listitem>
  82. </itemizedlist>
  83. <itemizedlist>
  84. <listitem>
  85. <para>
  86. <emphasis>str* aor</emphasis> - Address of record (aka
  87. username) of the record, that should be deleted.
  88. </para>
  89. </listitem>
  90. </itemizedlist>
  91. </section>
  92. <section id="ul_get_urecord">
  93. <title>
  94. <function>ul_get_urecord(domain, aor)</function>
  95. </title>
  96. <para>
  97. The function returns pointer to record with given Address of Record.
  98. </para>
  99. <para>Meaning of the parameters is as follows:</para>
  100. <itemizedlist>
  101. <listitem>
  102. <para>
  103. <emphasis>udomain_t* domain</emphasis> - Pointer to domain
  104. returned by ul_register_udomain.
  105. </para>
  106. </listitem>
  107. </itemizedlist>
  108. <itemizedlist>
  109. <listitem>
  110. <para>
  111. <emphasis>str* aor</emphasis> - Address of Record of
  112. request record.
  113. </para>
  114. </listitem>
  115. </itemizedlist>
  116. </section>
  117. <section id="ul_lock_udomain">
  118. <title>
  119. <function>ul_lock_udomain(domain)</function>
  120. </title>
  121. <para>
  122. The function lock the specified domain, it means, that no other
  123. processes will be able to access during the time. This prevents
  124. race conditions. Scope of the lock is the specified domain, that
  125. means, that multiple domain can be accessed simultaneously, they
  126. don't block each other.
  127. </para>
  128. <para>Meaning of the parameters is as follows:</para>
  129. <itemizedlist>
  130. <listitem>
  131. <para><emphasis>udomain_t* domain</emphasis> - Domain to be locked.
  132. </para>
  133. </listitem>
  134. </itemizedlist>
  135. </section>
  136. <section id="ul_unlock_udomain">
  137. <title>
  138. <function>ul_unlock_udomain(domain)</function>
  139. </title>
  140. <para>
  141. Unlock the specified domain previously locked by ul_lock_udomain.
  142. </para>
  143. <para>Meaning of the parameters is as follows:</para>
  144. <itemizedlist>
  145. <listitem>
  146. <para><emphasis>udomain_t* domain</emphasis> - Domain to be unlocked.
  147. </para>
  148. </listitem>
  149. </itemizedlist>
  150. </section>
  151. <section id="ul_release_urecord">
  152. <title>
  153. <function>ul_release_urecord(record)</function>
  154. </title>
  155. <para>
  156. Do some sanity checks - if all contacts have been removed, delete
  157. the entire record structure.
  158. </para>
  159. <para>Meaning of the parameters is as follows:</para>
  160. <itemizedlist>
  161. <listitem>
  162. <para><emphasis>urecord_t* record</emphasis> - Record to be released.
  163. </para>
  164. </listitem>
  165. </itemizedlist>
  166. </section>
  167. <section id="ul_insert_ucontact">
  168. <title>
  169. <function>
  170. ul_insert_ucontact(record, contact, expires, q, callid, cseq,
  171. flags, cont, ua)
  172. </function>
  173. </title>
  174. <para>
  175. The function inserts a new contact in the given record with
  176. specified parameters.
  177. </para>
  178. <para>Meaning of the parameters is as follows:</para>
  179. <itemizedlist>
  180. <listitem>
  181. <para>
  182. <emphasis>urecord_t* record</emphasis> - Record in which
  183. the contact should be inserted.
  184. </para>
  185. </listitem>
  186. </itemizedlist>
  187. <itemizedlist>
  188. <listitem>
  189. <para>
  190. <emphasis>str* contact</emphasis> - Contact URI.
  191. </para>
  192. </listitem>
  193. </itemizedlist>
  194. <itemizedlist>
  195. <listitem>
  196. <para>
  197. <emphasis>time_t expires</emphasis> - Expires of the
  198. contact in absolute value.
  199. </para>
  200. </listitem>
  201. </itemizedlist>
  202. <itemizedlist>
  203. <listitem>
  204. <para>
  205. <emphasis>float q</emphasis> - q value of the contact.
  206. </para>
  207. </listitem>
  208. </itemizedlist>
  209. <itemizedlist>
  210. <listitem>
  211. <para>
  212. <emphasis>str* callid</emphasis> - Call-ID of the REGISTER
  213. message that contained the contact.
  214. </para>
  215. </listitem>
  216. </itemizedlist>
  217. <itemizedlist>
  218. <listitem>
  219. <para>
  220. <emphasis>int cseq</emphasis> - CSeq of the REGISTER
  221. message that contained the contact.
  222. </para>
  223. </listitem>
  224. </itemizedlist>
  225. <itemizedlist>
  226. <listitem>
  227. <para>
  228. <emphasis>unsigned int flags</emphasis> - Flags to be set.
  229. </para>
  230. </listitem>
  231. </itemizedlist>
  232. <itemizedlist>
  233. <listitem>
  234. <para>
  235. <emphasis>ucontact_t* cont</emphasis> - Pointer to newly
  236. created structure.
  237. </para>
  238. </listitem>
  239. </itemizedlist>
  240. <itemizedlist>
  241. <listitem>
  242. <para>
  243. <emphasis>str* ua</emphasis> - User-Agent of the REGISTER
  244. message that contained the contact.
  245. </para>
  246. </listitem>
  247. </itemizedlist>
  248. </section>
  249. <section id="ul_delete_ucontact">
  250. <title>
  251. <function>ul_delete_ucontact(record, contact)</function>
  252. </title>
  253. <para>
  254. The function deletes given contact from record.
  255. </para>
  256. <para>Meaning of the parameters is as follows:</para>
  257. <itemizedlist>
  258. <listitem>
  259. <para><emphasis>urecord_t* record</emphasis> - Record from which the contact should be removed.
  260. </para>
  261. </listitem>
  262. </itemizedlist>
  263. <itemizedlist>
  264. <listitem>
  265. <para><emphasis>ucontact_t* contact</emphasis> - Contact to be deleted.
  266. </para>
  267. </listitem>
  268. </itemizedlist>
  269. </section>
  270. <section id="ul_get_ucontact">
  271. <title>
  272. <function>ul_get_ucontact(record, contact)</function>
  273. </title>
  274. <para>
  275. The function tries to find contact with given Contact URI and returns pointer to
  276. structure representing the contact.
  277. </para>
  278. <para>Meaning of the parameters is as follows:</para>
  279. <itemizedlist>
  280. <listitem>
  281. <para>
  282. <emphasis>urecord_t* record</emphasis> - Record to be
  283. searched for the contact.
  284. </para>
  285. </listitem>
  286. </itemizedlist>
  287. <itemizedlist>
  288. <listitem>
  289. <para>
  290. <emphasis>str_t* contact</emphasis> - URI of the request
  291. contact.
  292. </para>
  293. </listitem>
  294. </itemizedlist>
  295. </section>
  296. <section id="ul_get_all_ucontacts">
  297. <title>
  298. <function>ul_get_all_ucontacts(buf, len, flags)</function>
  299. </title>
  300. <para>
  301. The function retrieves all contacts of all registered users and
  302. returns them in the caller-supplied buffer. If the buffer is too
  303. small, the function returns positive value indicating how much
  304. additional space would be necessary to accommodate all of
  305. them. Please note that the positive return value should be used
  306. only as a "hint", as there is no guarantee that during
  307. the time between two subsequent calls number of registered contacts
  308. will remain the same.
  309. </para>
  310. <para>
  311. If flag parameter is set to non-zero value then only contacts that
  312. have the specified flags set will be returned. It is, for example,
  313. possible to list only contacts that are behind NAT.
  314. </para>
  315. <para>Meaning of the parameters is as follows:</para>
  316. <itemizedlist>
  317. <listitem>
  318. <para>
  319. <emphasis>void* buf</emphasis> - Buffer for returning contacts.
  320. </para>
  321. </listitem>
  322. </itemizedlist>
  323. <itemizedlist>
  324. <listitem>
  325. <para>
  326. <emphasis>int len</emphasis> - Length of the buffer.
  327. </para>
  328. </listitem>
  329. </itemizedlist>
  330. <itemizedlist>
  331. <listitem>
  332. <para>
  333. <emphasis>unsigned int flags</emphasis> - Flags that must be set.
  334. </para>
  335. </listitem>
  336. </itemizedlist>
  337. </section>
  338. <section id="ul_update_ucontact">
  339. <title>
  340. <function>
  341. ul_update_ucontact(contact, expires, q, callid, cseq, set, res,
  342. ua)
  343. </function>
  344. </title>
  345. <para>
  346. The function updates contact with new values.
  347. </para>
  348. <para>Meaning of the parameters is as follows:</para>
  349. <itemizedlist>
  350. <listitem>
  351. <para>
  352. <emphasis>ucontact_t* contact</emphasis> - Contact URI.
  353. </para>
  354. </listitem>
  355. </itemizedlist>
  356. <itemizedlist>
  357. <listitem>
  358. <para>
  359. <emphasis>time_t expires</emphasis> - Expires of the contact in absolute value.
  360. </para>
  361. </listitem>
  362. </itemizedlist>
  363. <itemizedlist>
  364. <listitem>
  365. <para>
  366. <emphasis>float q</emphasis> - q value of the contact.
  367. </para>
  368. </listitem>
  369. </itemizedlist>
  370. <itemizedlist>
  371. <listitem>
  372. <para>
  373. <emphasis>str* callid</emphasis> - Call-ID of the REGISTER message that contained the contact.
  374. </para>
  375. </listitem>
  376. </itemizedlist>
  377. <itemizedlist>
  378. <listitem>
  379. <para>
  380. <emphasis>int cseq</emphasis> - CSeq of the REGISTER message that contained the contact.
  381. </para>
  382. </listitem>
  383. </itemizedlist>
  384. <itemizedlist>
  385. <listitem>
  386. <para>
  387. <emphasis>unsigned int set</emphasis> - OR value of flags to be set.
  388. </para>
  389. </listitem>
  390. </itemizedlist>
  391. <itemizedlist>
  392. <listitem>
  393. <para>
  394. <emphasis>unsigned int res</emphasis> - OR value of flags to be reset.
  395. </para>
  396. </listitem>
  397. </itemizedlist>
  398. <itemizedlist>
  399. <listitem>
  400. <para>
  401. <emphasis>str* ua</emphasis> - User-Agent of the REGISTER message that contained the contact.
  402. </para>
  403. </listitem>
  404. </itemizedlist>
  405. </section>
  406. </section>