usrloc_devel.xml 13 KB

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