Browse code

textopsx: docs for hdr iterator functions

Daniel-Constantin Mierla authored on 07/07/2021 10:28:54
Showing 1 changed files
... ...
@@ -482,5 +482,87 @@ if (@hf_value_exists.supported.path == "1") {
482 482
 	    </programlisting>
483 483
 	</example>
484 484
     </section>
485
+	<section id="textopsx.f.hf_iterator_start">
486
+		<title>
487
+		<function moreinfo="none">hf_iterator_start(iname)</function>
488
+		</title>
489
+		<para>
490
+			Start an iterator for headers in the current SIP message.
491
+			The parameter iname is used to identify the iterator. There
492
+			can be up to 4 iterators at the same time, with different name.
493
+		</para>
494
+		<para>
495
+			The parameter can be a dynamic string with variables.
496
+		</para>
497
+		<para>
498
+			This function can be used from ANY_ROUTE.
499
+		</para>
500
+		<example>
501
+		<title><function>hf_iterator_start</function> usage</title>
502
+		<programlisting format="linespecific">
503
+...
504
+hf_iterator_start("i1");
505
+...
506
+</programlisting>
507
+		</example>
508
+	</section>
509
+	<section id="textopsx.f.hf_iterator_end">
510
+		<title>
511
+		<function moreinfo="none">hf_iterator_end(iname)</function>
512
+		</title>
513
+		<para>
514
+			Close the iterator identified by iname parameter. The iname value
515
+			must be the same used for sht_iterator_start().
516
+		</para>
517
+		<para>
518
+			The parameter can be dynamic string with variables.
519
+		</para>
520
+		<para>
521
+			This function can be used from ANY_ROUTE.
522
+		</para>
523
+		<example>
524
+		<title><function>hf_iterator_end</function> usage</title>
525
+		<programlisting format="linespecific">
526
+...
527
+hf_iterator_end("i1");
528
+...
529
+</programlisting>
530
+		</example>
531
+	</section>
532
+	<section id="textopsx.f.hf_iterator_next">
533
+		<title>
534
+		<function moreinfo="none">textopsx.f.hf_iterator_next(iname)</function>
535
+		</title>
536
+		<para>
537
+			Move the iterator to the next header. It must
538
+			be called also after sht_iterator_start() to get the first
539
+			header.
540
+		</para>
541
+		<para>
542
+			The return code is false when there is no other header in the list.
543
+		</para>
544
+		<para>
545
+			The item name and value are accessible via variables:
546
+			$hfitname(iname) and $hfitbody(iname).
547
+		</para>
548
+		<para>
549
+			The parameter can be dynamic string with variables.
550
+		</para>
551
+		<para>
552
+			This function can be used from ANY_ROUTE.
553
+		</para>
554
+		<example>
555
+		<title><function>hf_iterator_next</function> usage</title>
556
+		<programlisting format="linespecific">
557
+...
558
+    hf_iterator_start("i1");
559
+    while(hf_iterator_next("i1")) {
560
+        xlog("hdr[$hfitname(i1)] is: $hfitbody(i1)\n");
561
+    }
562
+    hf_iterator_end("i1");
563
+...
564
+</programlisting>
565
+		</example>
566
+	</section>
485 567
 
486 568
 </section>