File: smsg.h

package info (click to toggle)
libosip 0.9.7-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,852 kB
  • ctags: 1,812
  • sloc: ansic: 20,266; sh: 9,218; makefile: 215
file content (2794 lines) | stat: -rw-r--r-- 95,378 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
/*
  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
  Copyright (C) 2001,2002,2003  Aymeric MOIZARD jack@atosc.org
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


#ifndef _SMSG_H_
#define _SMSG_H_

#include <osip/const.h>		/* constant definitions */
#include <osip/smsgtypes.h>	/* type     definitions */

/**
 * @file smsg.h
 * @brief oSIP parser Routines
 *
 * This is the SIP accessor and parser related API.
 * <BR>Understanding the parser implementation will prevent you from
 * using it improperly. Read this carefully.<BR>
 * <BR>This implementation could be seen as a partial implementation
 * of the whole SIP syntax. In other words, the parser is 'tolerant'
 * and will not detect a lot of error cases. As an example, no error
 * will be detected while trying to parse the following request-uri:
 * <BR><pre><code>INVITE sip:jack@atosc.org:abcd SIP/2.0</pre></code>
 * <BR>This code shows that even if your SIP message is parsed
 * correctly by oSIP, it may still be not compliant. This could be
 * used by attackers to make your application crash or whatever.
 * In this example, if you are trying to call the atoi() method with
 * the string 'abcd', your application will crash. Of course, there
 * exist solutions! You can check yourself for the validity of the
 * string or use the strtol() method (found on most unix) which is
 * capable of detecting such error cases.
 * <BR>Are you wondering why the parser has been built this way?
 * <BR>The initial answer is that each SIP application have
 * different requirement and some (the proxy!) needs SIP message
 * to be parsed as quickly as possible. Also, most applications
 * only need a few information from a SIP message. (the first Via
 * is the only one interesting!). If the parser was fully checking each
 * Via field validity, it would consume too much CPU on useless
 * operations. If you think this model does not fit your application,
 * then you should buy a slow stack :-).
 * <BR>Is there any plan to change that behaviour?
 * <BR>I do not need it, but if this interest you, it would be
 * possible to compile oSIP in 2 different ways: a full checker
 * model could be useful for SIP application with no performance
 * requirements. Any contributions is welcomed and will be merged
 * if it's made optional.
 */

/**
 * @defgroup oSIP_SMSG oSIP parser Handling
 * @ingroup oSIP
 * @{
 */

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * Initialise the oSIP parser.
 */
  int parser_init ();

/**
 * Fix the via header for INCOMING requests only.
 * a copy of ip_addr is done.
 */
  int msg_fix_last_via_header (sip_t * request, char *ip_addr, int port);

/**
 * Allocate a sip_t element.
 * @param sip The element to allocate.
 */
  int msg_init (sip_t ** sip);
/**
 * Free all resource in a sip_t element.
 * @param sip The element to free.
 */
  void msg_free (sip_t * sip);
/**
 * Parse a sip_t element.
 * @param sip The resulting element.
 * @param message The buffer to parse.
 */
  int msg_parse (sip_t * sip, char *message);
/**
 * Get a string representation of a sip_t element.
 * @param sip The element to work on.
 * @param dest new allocated buffer returned.
 */
  int msg_2char (sip_t * sip, char **dest);
/**
 * Clone a sip_t element.
 * @param sip The element to clone.
 * @param dest The new allocated element cloned.
 */
  int msg_clone (sip_t * sip, sip_t ** dest);

/**
 * define this macro to avoid building several times
 * the message on retransmissions. If you have changed
 * the sip_t element since last call of msg_2char() you
 * can call msg_force_update() to force a rebuild.
*/
#ifdef USE_TMP_BUFFER
/**
 * Check if the element is already built. (so msg_2char won't build it again)
 * @param sip The element to check.
*/
  int msg_get_property (sip_t * sip);
#endif

/**
 * Force a sip_t element to be rebuild on next msg_2char() call.
 * @param sip The element to work on.
 */
  int msg_force_update (sip_t * sip);

/**
 * Get the usual reason phrase as defined in SIP for a specific status code.
 * @param status_code A status code.
 */
  char *msg_getreason (int status_code);
/**
 * Set the reason phrase. This is entirely free in SIP.
 * @param sip The element to work on.
 * @param reason The reason phrase.
 */
  void msg_setreasonphrase (sip_t * sip, char *reason);
/**
 * Get the reason phrase. This is entirely free in SIP.
 * @param sip The element to work on.
 */
  char *msg_getreasonphrase (sip_t * sip);
/**
 * Set the status code. This is entirely free in SIP.
 * @param sip The element to work on.
 * @param statuscode The status code.
 */
  void msg_setstatuscode (sip_t * sip, char *statuscode);
/**
 * Get the status code.
 * @param sip The element to work on.
 */
  char *msg_getstatuscode (sip_t * sip);
/**
 * Set the method. You can set any string here.
 * @param sip The element to work on.
 * @param method The method name.
 */
  void msg_setmethod (sip_t * sip, char *method);
/**
 * Get the method name.
 * @param sip The element to work on.
 */
  char *msg_getmethod (sip_t * sip);
/**
 * Set the SIP version used. (use "SIP/2.0")
 * @param sip The element to work on.
 * @param version The version of SIP.
 */
  void msg_setversion (sip_t * sip, char *version);
/**
 * Get the SIP version.
 * @param sip The element to work on.
 */
  char *msg_getversion (sip_t * sip);
/**
 * Set the Request-URI.
 * @param sip The element to work on.
 * @param uri The uri to set.
 */
  void msg_seturi (sip_t * sip, url_t * uri);
/**
 * Get the Request-URI.
 * @param sip The element to work on.
 */
  url_t *msg_geturi (sip_t * sip);

/**
 * Set the Accept header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setaccept (sip_t * sip, char *hvalue);
/**
 * Get one Accept header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getaccept (sip_t * sip, int pos, accept_t ** dest);
/**
 * Set the Accept-encoding header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setaccept_encoding (sip_t * sip, char *hvalue);
/**
 * Get one Accept-encoding header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getaccept_encoding (sip_t * sip, int pos,
			      accept_encoding_t ** dest);
/**
 * Set the Accept-language header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setaccept_language (sip_t * sip, char *hvalue);
/**
 * Get one Accept header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getaccept_language (sip_t * sip, int pos,
			      accept_language_t ** dest);
/**
 * Set the Alert-info header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setalert_info (sip_t * sip, char *hvalue);
/**
 * Get one Alert-info header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getalert_info (sip_t * sip, int pos, alert_info_t ** dest);
/**
 * Set the Allow header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setallow (sip_t * sip, char *hvalue);
/**
 * Get one Allow header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getallow (sip_t * sip, int pos, allow_t ** dest);
/**
 * Set the Authorization header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setauthorization (sip_t * sip, char *hvalue);
/**
 * Get one Authorization header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getauthorization (sip_t * sip, int pos, authorization_t ** dest);
/**
 * Set the Call-id header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcall_id (sip_t * sip, char *hvalue);
/**
 * Get one Call-id header.
 * @param sip The element to work on.
 */
  call_id_t *msg_getcall_id (sip_t * sip);
/**
 * Set the Call-info header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcall_info (sip_t * sip, char *hvalue);
/**
 * Get one Call-info header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getcall_info (sip_t * sip, int pos, call_info_t ** dest);
/**
 * Set the Contact header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcontact (sip_t * sip, char *hvalue);
/**
 * Get one Contact header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getcontact (sip_t * sip, int pos, contact_t ** dest);
/**
 * Set the Content-disposition header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcontent_disposition (sip_t * sip, char *hvalue);
/**
 * Get one Content-disposition header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getcontent_disposition (sip_t * sip, int pos,
				  content_disposition_t ** dest);
/**
 * Set the Content-encoding header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcontent_encoding (sip_t * sip, char *hvalue);
/**
 * Get one Content-encoding header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getcontent_encoding (sip_t * sip, int pos,
			       content_encoding_t ** dest);
/**
 * Set the Content-length header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcontent_length (sip_t * sip, char *hvalue);
/**
 * Get one Content-length header.
 * @param sip The element to work on.
 */
  content_length_t *msg_getcontent_length (sip_t * sip);
/**
 * Set the Content-type header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcontent_type (sip_t * sip, char *hvalue);
/**
 * Get one Content-type header.
 * @param sip The element to work on.
 */
  content_type_t *msg_getcontent_type (sip_t * sip);
/**
 * Set the Cseq header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setcseq (sip_t * sip, char *hvalue);
/**
 * Get one Cseq header.
 * @param sip The element to work on.
 */
  cseq_t *msg_getcseq (sip_t * sip);
/**
 * Set the Error-info header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_seterror_info (sip_t * sip, char *hvalue);
/**
 * Get one Error-info header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_geterror_info (sip_t * sip, int pos, error_info_t ** dest);
/**
 * Set the From header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setfrom (sip_t * sip, char *hvalue);
/**
 * Get the From header.
 * @param sip The element to work on.
 */
  from_t *msg_getfrom (sip_t * sip);
/**
 * Set the mime-version header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setmime_version (sip_t * sip, char *hvalue);
/**
 * Get the Mime-version header.
 * @param sip The element to work on.
 */
  mime_version_t *msg_getmime_version (sip_t * sip);
/**
 * Set the Proxy-authenticate header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setproxy_authenticate (sip_t * sip, char *hvalue);
/**
 * Get the Proxy-authenticate header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getproxy_authenticate (sip_t * sip, int pos,
				 proxy_authenticate_t ** dest);
/**
 * Set the Proxy-authorization header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setproxy_authorization (sip_t * sip, char *hvalue);
/**
 * Get one Proxy-authorization header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getproxy_authorization (sip_t * sip, int pos,
				  proxy_authorization_t ** dest);
/**
 * Set the Record-Route header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setrecord_route (sip_t * sip, char *hvalue);
/**
 * Get one Record-route header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getrecord_route (sip_t * sip, int pos, record_route_t ** dest);
/**
 * Set the Route header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setroute (sip_t * sip, char *hvalue);
/**
 * Get one Route header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getroute (sip_t * sip, int pos, route_t ** dest);
/**
 * Set the To header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setto (sip_t * sip, char *hvalue);
/**
 * Get the To header.
 * @param sip The element to work on.
 */
  to_t *msg_getto (sip_t * sip);
/**
 * Set the Via header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setvia (sip_t * sip, char *hvalue);
/**
 * Get one Via header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getvia (sip_t * sip, int pos, via_t ** dest);
/**
 * Set the Www-authenticate header.
 * @param sip The element to work on.
 * @param hvalue The string describing the element.
 */
  int msg_setwww_authenticate (sip_t * sip, char *hvalue);
/**
 * Get one Www-authenticate header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getwww_authenticate (sip_t * sip, int pos,
			       www_authenticate_t ** dest);
/**
 * Allocate and Add an "unknown" header (not defined in oSIP).
 * @param sip The element to work on.
 * @param hname The token name.
 * @param hvalue The token value.
 */
  int msg_setheader (sip_t * sip, char *hname, char *hvalue);
/**
 * Allocate and Add an "unknown" header (not defined in oSIP).
 * The element is add on the top of the unknown header list. 
 * @param sip The element to work on.
 * @param hname The token name.
 * @param hvalue The token value.
 */
  int msg_settopheader (sip_t * sip, char *hname, char *hvalue);
/**
 * Find an "unknown" header. (not defined in oSIP)
 * @param sip The element to work on.
 * @param hname The name of the header to find.
 * @param pos The index where to start searching for the header.
 * @param dest A pointer to the header found.
 */
  int msg_header_getbyname (sip_t * sip, char *hname, int pos,
			    header_t ** dest);
/**
 * Get one "unknown" header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the header found.
 */
  int msg_getheader (sip_t * sip, int pos, header_t ** dest);

/**
 * Set the Body of the SIP message.
 * @param sip The element to work on.
 * @param buf The string containing the body.
 */
  int msg_setbody (sip_t * sip, char *buf);
/**
 * Set a type for a body. (NOT TESTED! use with care)
 * @param sip The element to work on.
 * @param buf the mime type of body.
 */
  int msg_setbody_mime (sip_t * sip, char *buf);
/**
 * Get one body header.
 * @param sip The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the body found.
 */
  int msg_getbody (sip_t * sip, int pos, body_t ** dest);


/*
 *  These are helpfull MACROs to test messages type.
 */
/**
 * Test if the message is a SIP RESPONSE
 * @param msg the SIP message.
 */
#define MSG_IS_RESPONSE(msg) ((msg)->strtline->statuscode!=NULL)
/**
 * Test if the message is a SIP REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_REQUEST(msg)  ((msg)->strtline->statuscode==NULL)

/**
 * Test if the message is an INVITE REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_INVITE(msg)   (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"INVITE",6))
/**
 * Test if the message is an ACK REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_ACK(msg)      (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"ACK",3))
/**
 * Test if the message is a REGISTER REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_REGISTER(msg) (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"REGISTER",8))
/**
 * Test if the message is a BYE REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_BYE(msg)      (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"BYE",3))
/**
 * Test if the message is an OPTIONS REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_OPTIONS(msg)  (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"OPTIONS",7))
/**
 * Test if the message is an INFO REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_INFO(msg)     (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"INFO",4))
/**
 * Test if the message is a CANCEL REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_CANCEL(msg)   (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"CANCEL",6))
/**
 * Test if the message is a REFER REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_REFER(msg)   (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"REFER",5))
/**
 * Test if the message is a NOTIFY REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_NOTIFY(msg)   (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"NOTIFY",6))
/**
 * Test if the message is a SUBSCRIBE REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_SUBSCRIBE(msg)  (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"SUBSCRIBE",9))
/**
 * Test if the message is a MESSAGE REQUEST
 * @param msg the SIP message.
 */
#define MSG_IS_MESSAGE(msg)  (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"MESSAGE",7))
/**
 * Test if the message is a PRACK REQUEST  (!! PRACK IS NOT SUPPORTED by the fsm!!)
 * @param msg the SIP message.
 */
#define MSG_IS_PRACK(msg)    (MSG_IS_REQUEST(msg) && \
			      0==strncmp((msg)->strtline->sipmethod,"PRACK",5))

/**
 * Test if the message is a response with status between 100 and 199
 * @param msg the SIP message.
 */
#define MSG_IS_STATUS_1XX(msg) (MSG_IS_RESPONSE(msg) && \
				0==strncmp((msg)->strtline->statuscode,"1",1))
/**
 * Test if the message is a response with status between 200 and 299
 * @param msg the SIP message.
 */
#define MSG_IS_STATUS_2XX(msg) (MSG_IS_RESPONSE(msg) && \
				0==strncmp((msg)->strtline->statuscode,"2",1))
/**
 * Test if the message is a response with status between 300 and 399
 * @param msg the SIP message.
 */
#define MSG_IS_STATUS_3XX(msg) (MSG_IS_RESPONSE(msg) && \
				0==strncmp((msg)->strtline->statuscode,"3",1))
/**
 * Test if the message is a response with status between 400 and 499
 * @param msg the SIP message.
 */
#define MSG_IS_STATUS_4XX(msg) (MSG_IS_RESPONSE(msg) && \
				0==strncmp((msg)->strtline->statuscode,"4",1))
/**
 * Test if the message is a response with status between 500 and 599
 * @param msg the SIP message.
 */
#define MSG_IS_STATUS_5XX(msg) (MSG_IS_RESPONSE(msg) && \
				0==strncmp((msg)->strtline->statuscode,"5",1))
/**
 * Test if the message is a response with status between 600 and 699
 * @param msg the SIP message.
 */
#define MSG_IS_STATUS_6XX(msg) (MSG_IS_RESPONSE(msg) && \
				0==strncmp((msg)->strtline->statuscode,"6",1))
/**
 * Test if the message is a response with a status set to the code value.
 * @param msg the SIP message.
 * @param code the status code.
 */
#define MSG_TEST_CODE(msg,code) (MSG_IS_RESPONSE(msg) && \
				 code==(int)satoi((msg)->strtline->statuscode))
/**
 * Test if the message is a response for a REQUEST of certain type
 * @param msg the SIP message.
 * @param requestname the method name to match.
 */
#define MSG_IS_RESPONSEFOR(msg,requestname)  (MSG_IS_RESPONSE(msg) && \
				 0==strcmp((msg)->cseq->method,requestname))

/**
 * Allocate a body_t element.
 * @param body The element to work on.
 */
  int body_init (body_t ** body);
/**
 * Free a body_t element.
 * @param body The element to work on.
 */
  void body_free (body_t * body);
/**
 * Parse a body_t element.
 * @param body The element to work on.
 * @param buf The buffer to parse.
 */
  int body_parse (body_t * body, char *buf);
/**
 * Parse a body_t element. (for mime message format) (NOT TESTED, use with care)
 * @param body The element to work on.
 * @param buf The buffer to parse.
 */
  int body_parse_mime (body_t * body, char *buf);
/**
 * Get a string representation of a body_t element.
 * @param body The element to work on.
 * @param dest The resulting buffer.
 */
  int body_2char (body_t * body, char **dest);

/**
 * Allocate a generic parameter element.
 * @param GP The element to work on.
 */
#define generic_param_init(GP) url_param_init(GP)
/**
 * Free a generic parameter element.
 * @param GP The element to work on.
 */
#define generic_param_free(GP) url_param_free(GP)
/**
 * Set values of a generic parameter element.
 * @param GP The element to work on.
 * @param NAME The token name.
 * @param VALUE The token value.
 */
#define generic_param_set(GP, NAME, VALUE)  url_param_set(GP, NAME, VALUE)
/**
 * Clone a generic parameter element.
 * @param GP The element to work on.
 * @param DEST The resulting new allocated buffer.
 */
#define generic_param_clone(GP,DEST)     url_param_clone(GP,DEST)
#ifndef DOXYGEN
/*
 * Free a list of a generic parameter element.
 * @param LIST The list of generic parameter element to free.
 */
#define generic_param_freelist(LIST)       url_param_freelist(LIST)
#endif
/**
 * Allocate and add a generic parameter element in a list.
 * @param LIST The list of generic parameter element to work on.
 * @param NAME The token name.
 * @param VALUE The token value.
 */
#define generic_param_add(LIST,NAME,VALUE)        url_param_add(LIST,NAME,VALUE)
/**
 * Find in a generic parameter element in a list.
 * @param LIST The list of generic parameter element to work on.
 * @param NAME The name of the parameter element to find.
 * @param DEST A pointer on the element found.
 */
#define generic_param_getbyname(LIST,NAME,DEST) url_param_getbyname(LIST,NAME,DEST)

/**
 * Set the name of a generic parameter element.
 * @param generic_param The element to work on.
 * @param name the token name to set.
 */
  void generic_param_setname (generic_param_t * generic_param, char *name);
/**
 * Get the name of a generic parameter element.
 * @param generic_param The element to work on.
 */
  char *generic_param_getname (generic_param_t * generic_param);
/**
 * Set the value of a generic parameter element.
 * @param generic_param The element to work on.
 * @param value the token name to set.
 */
  void generic_param_setvalue (generic_param_t * generic_param, char *value);
/**
 * Get the value of a generic parameter element.
 * @param generic_param The element to work on.
 */
  char *generic_param_getvalue (generic_param_t * generic_param);


/**
 * Allocate a header element.
 * @param header The element to work on.
 */
  int header_init (header_t ** header);
/**
 * Free a header element.
 * @param header The element to work on.
 */
  void header_free (header_t * header);
/**
 * Get a string representation of a header element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated buffer.
 */
  int header_2char (header_t * header, char **dest);
/**
 * Get the token name a header element.
 * @param header The element to work on.
 */
  char *header_getname (header_t * header);
/**
 * Set the token name a header element.
 * @param header The element to work on.
 * @param pname The token name to set.
 */
  void header_setname (header_t * header, char *pname);
/**
 * Get the token value a header element.
 * @param header The element to work on.
 */
  char *header_getvalue (header_t * header);
/**
 * Set the token value a header element.
 * @param header The element to work on.
 * @param pvalue The token value to set.
 */
  void header_setvalue (header_t * header, char *pvalue);
/**
 * Clone a header element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int header_clone (header_t * header, header_t ** dest);

/**
 * Allocate an Accept element.
 * @param header The element to work on.
 */
#define accept_init(header)     content_type_init(header)
/**
 * Free an Accept element.
 * @param header The element to work on.
 */
#define accept_free(header)     content_type_free(header)
/**
 * Parse an Accept element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define accept_parse(header, hvalue) content_type_parse(header, hvalue)
/**
 * Get a string representation of an Accept element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define accept_2char(header, dest) content_type_2char(header, dest)
/**
 * Clone an Accept element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define accept_clone(header, dest) content_type_clone(header, dest)

/**
 * Allocate and add a header parameter in an Accept element.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define accept_param_add(header,name,value)  generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in an Accept element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define accept_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Allocate a Accept-Encoding element.
 * @param header The element to work on.
 */
  int accept_encoding_init (accept_encoding_t ** header);
/**
 * Parse a Accept-Encoding element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int accept_encoding_parse (accept_encoding_t * header, char *hvalue);
/**
 * Get a string representation of a Accept-Encoding element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int accept_encoding_2char (accept_encoding_t * header, char **dest);
/**
 * Free a Accept-Encoding element.
 * @param header The element to work on.
 */
  void accept_encoding_free (accept_encoding_t * header);
/**
 * Clone a Accept-Encoding element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int accept_encoding_clone (accept_encoding_t * header,
			     accept_encoding_t ** dest);

/**
 * Set the value of an Accept-Encoding element.
 * @param header The element to work on.
 * @param value The token value to set.
 */
  void accept_encoding_setelement (accept_encoding_t * header, char *value);
/**
 * Get the value of an Accept-Encoding element.
 * @param header The element to work on.
 */
  char *accept_encoding_getelement (accept_encoding_t * header);
/**
 * Allocate and Add a header parameter in an Accept-Encoding element.
 * @param header The element to work on.
 * @param name The token name for the new parameter.
 * @param value The token value for the new parameter.
 */
#define accept_encoding_param_add(header,name,value)  generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in an Accept-Encoding element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define accept_encoding_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Allocate an Accept-Language element.
 * @param header The element to work on.
 */
#define accept_language_init(header)      accept_encoding_init(header)
/**
 * Parse an Accept-Language element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define accept_language_parse(header, hvalue)  accept_encoding_parse(header, hvalue)
/**
 * Get a string representation of an Accept-Language element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define accept_language_2char(header, dest)  accept_encoding_2char(header, dest)
/**
 * Free an Accept-Language element.
 * @param header The element to work on.
 */
#define accept_language_free(header)      accept_encoding_free(header)
/**
 * Clone an Accept-Language element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define accept_language_clone(header, dest) accept_encoding_clone(header, dest)

/**
 * Get the value of an Accept-Language element.
 * @param header The element to work on.
 */
#define accept_language_getelement(header)     accept_encoding_getelement(header)
/**
 * Set the value of an Accept-Language element.
 * @param header The element to work on.
 * @param value The value to set.
 */
#define accept_language_setelement(header, value)  accept_encoding_setelement(header, value)
/**
 * Allocate and add a generic parameter element in an Accept-Language element.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define accept_language_param_add(header,name,value)  generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in a Accept-Language element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define accept_language_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Allocate a Alert-Info element.
 * @param header The element to work on.
 */
#define  alert_info_init(header)      call_info_init(header)
/**
 * Free a Alert-Info element.
 * @param header The element to work on.
 */
#define  alert_info_free(header)      call_info_free(header)
/**
 * Parse a Alert-Info element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define  alert_info_parse(header, hvalue)  call_info_parse(header, hvalue)
/**
 * Get a string representation of a Alert-Info element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define  alert_info_2char(header,dest)   call_info_2char(header,dest)
/**
 * Clone a Alert-Info element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define  alert_info_clone(header, dest)  call_info_clone(header, dest)
/**
 * Get uri from an Alert-Info element.
 * @param header The element to work on.
 */
#define  alert_info_geturi(header)    call_info_geturi(header)
/**
 * Set the uri of an Alert-Info element.
 * @param header The element to work on.
 * @param uri The value of the new parameter.
 */
#define  alert_info_seturi(header, uri) call_info_seturi(header, uri)

/**
 * Allocate a Allow element.
 * @param header The element to work on.
 */
#define allow_init(header)      content_length_init(header)
/**
 * Parse a Allow element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define allow_parse(header, hvalue)  content_length_parse(header, hvalue)
/**
 * Get a string representation of a Allow element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define allow_2char(header, dest)  content_length_2char(header, dest)
/**
 * Free a Allow element.
 * @param header The element to work on.
 */
#define allow_free(header)      content_length_free(header)
/**
 * Clone a Allow element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define allow_clone(header, dest)  content_length_clone(header, dest)

/**
 * Allocate a Authorization element.
 * @param header The element to work on.
 */
  int authorization_init (authorization_t ** header);
/**
 * Parse a Authorization element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int authorization_parse (authorization_t * header, char *hvalue);
/**
 * Get a string representation of a Authorization element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int authorization_2char (authorization_t * header, char **dest);
/**
 * Free a Authorization element.
 * @param header The element to work on.
 */
  void authorization_free (authorization_t * header);
/**
 * Clone a Authorization element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int authorization_clone (authorization_t * header, authorization_t ** dest);

/**
 * Get value of the auth_type parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getauth_type (authorization_t * header);
/**
 * Add the auth_type parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setauth_type (authorization_t * header, char *value);
/**
 * Get value of the username parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getusername (authorization_t * header);
/**
 * Add the username parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setusername (authorization_t * header, char *value);
/**
 * Get value of the realm parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getrealm (authorization_t * header);
/**
 * Add the realm parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setrealm (authorization_t * header, char *value);
/**
 * Get value of the nonce parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getnonce (authorization_t * header);
/**
 * Add the nonce parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setnonce (authorization_t * header, char *value);
/**
 * Get value of the uri parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_geturi (authorization_t * header);
/**
 * Add the uri parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_seturi (authorization_t * header, char *value);
/**
 * Get value of the response parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getresponse (authorization_t * header);
/**
 * Add the response parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setresponse (authorization_t * header, char *value);
/**
 * Get value of the digest parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getdigest (authorization_t * header);
/**
 * Add the digest parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setdigest (authorization_t * header, char *value);
/**
 * Get value of the algorithm parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getalgorithm (authorization_t * header);
/**
 * Add the algorithm parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setalgorithm (authorization_t * header, char *value);
/**
 * Get value of the cnonce parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getcnonce (authorization_t * header);
/**
 * Add the cnonce parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setcnonce (authorization_t * header, char *value);
/**
 * Get value of the opaque parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getopaque (authorization_t * header);
/**
 * Add the opaque parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setopaque (authorization_t * header, char *value);
/**
 * Get value of the message_qop parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getmessage_qop (authorization_t * header);
/**
 * Add the message_qop parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setmessage_qop (authorization_t * header, char *value);
/**
 * Get value of the nonce_count parameter from a Authorization element.
 * @param header The element to work on.
 */
  char *authorization_getnonce_count (authorization_t * header);
/**
 * Add the nonce_count parameter from a Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void authorization_setnonce_count (authorization_t * header, char *value);


/**
 * Allocate a Call-id element.
 * @param header The element to work on.
 */
  int call_id_init (call_id_t ** header);
/**
 * Free a Call-id element.
 * @param header The element to work on.
 */
  void call_id_free (call_id_t * header);
/**
 * Parse a Call-id element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int call_id_parse (call_id_t * header, char *hvalue);
/**
 * Get a string representation of a Call-id element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int call_id_2char (call_id_t * header, char **dest);
/**
 * Clone a Call-id element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int call_id_clone (call_id_t * header, call_id_t ** dest);
/**
 * Set the number in the Call-Id element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void call_id_setnumber (call_id_t * header, char *value);
/**
 * Get the number from a Call-Id header.
 * @param header The element to work on.
 */
  char *call_id_getnumber (call_id_t * header);
/**
 * Set the host in the Call-Id element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void call_id_sethost (call_id_t * header, char *value);
/**
 * Get the host from a Call-Id header.
 * @param header The element to work on.
 */
  char *call_id_gethost (call_id_t * header);

/**
 * Allocate a Call-Info element.
 * @param header The element to work on.
 */
  int call_info_init (call_info_t ** header);
/**
 * Free a Call-Info element.
 * @param header The element to work on.
 */
  void call_info_free (call_info_t * header);
/**
 * Parse a Call-Info element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int call_info_parse (call_info_t * header, char *hvalue);
/**
 * Get a string representation of a Call-Info element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int call_info_2char (call_info_t * header, char **dest);
/**
 * Clone a Call-Info element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int call_info_clone (call_info_t * header, call_info_t ** dest);
/**
 * Get the uri from a Call_Info header.
 * @param header The element to work on.
 */
  char *call_info_geturi (call_info_t * header);
/**
 * Set the uri in the Call_Info element.
 * @param header The element to work on.
 * @param uri The value of the element.
 */
  void call_info_seturi (call_info_t * header, char *uri);

/**
 * Allocate a Contact element.
 * @param header The element to work on.
 */
  int contact_init (contact_t ** header);
/**
 * Free a Contact element.
 * @param header The element to work on.
 */
  void contact_free (contact_t * header);
/**
 * Parse a Contact element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int contact_parse (contact_t * header, char *hvalue);
/**
 * Get a string representation of a Contact element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int contact_2char (contact_t * header, char **dest);
/**
 * Clone a Contact element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int contact_clone (contact_t * header, contact_t ** dest);
/**
 * Get the displayname from a Contact header.
 * @param header The element to work on.
 */
#define contact_getdisplayname(header) from_getdisplayname((from_t*)header)
/**
 * Set the displayname in the Contact element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
#define contact_setdisplayname(header,value) from_setdisplayname((from_t*)header, value)
/**
 * Get the url from a Contact header.
 * @param header The element to work on.
 */
#define contact_geturl(header)         from_geturl((from_t*)header)
/**
 * Set the url in the Contact element.
 * @param header The element to work on.
 * @param url The value of the element.
 */
#define contact_seturl(header,url)       from_seturl((from_t*)header,url)
/**
 * Get a header parameter from a Contact element.
 * @param header The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the element found.
 */
#define contact_param_get(header,pos,dest) from_param_get((from_t*)header,pos,dest)
/**
 * Allocate and add a generic parameter element in a list.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define contact_param_add(header,name, value) generic_param_add((header)->gen_params, name,value)
/**
 * Find a header parameter in a Contact element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define contact_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Allocate a Content-Disposition element.
 * @param header The element to work on.
 */
#define content_disposition_init(header)      call_info_init(header)
/**
 * Free a Content-Disposition element.
 * @param header The element to work on.
 */
#define content_disposition_free(header)      call_info_free(header)
/**
 * Parse a Content-Disposition element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int content_disposition_parse (content_disposition_t * header,
				 char *hvalue);
/**
 * Get a string representation of a Content-Disposition element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define content_disposition_2char(header,dest)   call_info_2char(header,dest)
/**
 * Clone a Content-Disposition element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define content_disposition_clone(header, dest)  call_info_clone(header, dest)

/* type is of: "render" | "session" | "icon" | "alert" */
/**
 * Set the type in the Content-Disposition element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
#define content_disposition_settype(header, value) call_info_seturi(header, value)
/**
 * Get the type from a Content-Disposition header.
 * @param header The element to work on.
 */
#define content_disposition_gettype(header)    call_info_geturi(header)

/**
 * Allocate a Content-Encoding element.
 * @param header The element to work on.
 */
#define content_encoding_init(header)      content_length_init(header)
/**
 * Parse a Content-Encoding element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define content_encoding_parse(header, hvalue)  content_length_parse(header, hvalue)
/**
 * Get a string representation of a Content-Encoding element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define content_encoding_2char(header, dest)  content_length_2char(header, dest)
/**
 * Free a Content-Encoding element.
 * @param header The element to work on.
 */
#define content_encoding_free(header)      content_length_free(header)
/**
 * Clone a Content-Encoding element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define content_encoding_clone(header, dest)  content_length_clone(header, dest)

/**
 * Allocate a Content-Length element.
 * @param header The element to work on.
 */
  int content_length_init (content_length_t ** header);
/**
 * Free a Content-Length element.
 * @param header The element to work on.
 */
  void content_length_free (content_length_t * header);
/**
 * Parse a Content-Length element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int content_length_parse (content_length_t * header, char *hvalue);
/**
 * Get a string representation of a Content-Length element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int content_length_2char (content_length_t * header, char **dest);
/**
 * Clone a Content-Length element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int content_length_clone (content_length_t * header,
			    content_length_t ** dest);

/**
 * Allocate a Content-Type element.
 * @param header The element to work on.
 */
  int content_type_init (content_type_t ** header);
/**
 * Free a Content-Type element.
 * @param header The element to work on.
 */
  void content_type_free (content_type_t * header);
/**
 * Parse a Content-Type element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int content_type_parse (content_type_t * header, char *hvalue);
/**
 * Get a string representation of a Content-Type element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int content_type_2char (content_type_t * header, char **dest);
/**
 * Clone a Content-Type element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int content_type_clone (content_type_t * header, content_type_t ** dest);

/**
 * Allocate and add a generic parameter element in a list.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define content_type_param_add(header,name,value)  generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in a Content-Type element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define content_type_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Allocate a CSeq element.
 * @param header The element to work on.
 */
  int cseq_init (cseq_t ** header);
/**
 * Free a CSeq element.
 * @param header The element to work on.
 */
  void cseq_free (cseq_t * header);
/**
 * Parse a CSeq element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int cseq_parse (cseq_t * header, char *hvalue);
/**
 * Get a string representation of a CSeq element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int cseq_2char (cseq_t * header, char **dest);
/**
 * Clone a CSeq element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int cseq_clone (cseq_t * header, cseq_t ** dest);
/**
 * Set the number in the CSeq element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void cseq_setnumber (cseq_t * header, char *value);
/**
 * Get the number from a CSeq header.
 * @param header The element to work on.
 */
  char *cseq_getnumber (cseq_t * header);
/**
 * Set the method in the CSeq element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void cseq_setmethod (cseq_t * header, char *value);
/**
 * Get the method from a CSeq header.
 * @param header The element to work on.
 */
  char *cseq_getmethod (cseq_t * header);

/**
 * Allocate a Error-Info element.
 * @param header The element to work on.
 */
#define  error_info_init(header)      call_info_init(header)
/**
 * Free a Error-Info element.
 * @param header The element to work on.
 */
#define  error_info_free(header)      call_info_free(header)
/**
 * Parse a Error-Info element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define  error_info_parse(header, hvalue)  call_info_parse(header, hvalue)
/**
 * Get a string representation of a Error-Info element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define  error_info_2char(header,dest)   call_info_2char(header,dest)
/**
 * Clone a Error-Info element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define  error_info_clone(header, dest)  call_info_clone(header, dest)

/**
 * Set the uri in the Error-Info element.
 * @param header The element to work on.
 * @param uri The uri of the element.
 */
#define  error_info_seturi(header, uri) call_info_seturi(header, uri)
/**
 * Get the uri from a Error-Info header.
 * @param header The element to work on.
 */
#define  error_info_geturi(header)    call_info_geturi(header)

/**
 * Allocate a From element.
 * @param header The element to work on.
 */
  int from_init (from_t ** header);
/**
 * Free a From element.
 * @param header The element to work on.
 */
  void from_free (from_t * header);
/**
 * Parse a From element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int from_parse (from_t * header, char *hvalue);
/**
 * Get a string representation of a From element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int from_2char (from_t * header, char **dest);
/**
 * Clone a From element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int from_clone (from_t * header, from_t ** dest);
/**
 * Set the displayname in the From element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void from_setdisplayname (from_t * header, char *value);
/**
 * Get the displayname from a From header.
 * @param header The element to work on.
 */
  char *from_getdisplayname (from_t * header);
/**
 * Set the url in the From element.
 * @param header The element to work on.
 * @param url The value of the element.
 */
  void from_seturl (from_t * header, url_t * url);
/**
 * Get the url from a From header.
 * @param header The element to work on.
 */
  url_t *from_geturl (from_t * header);
/**
 * Get a header parameter from a From element.
 * @param header The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the element found.
 */
  int from_param_get (from_t * header, int pos, generic_param_t ** dest);
/**
 * Allocate and add a generic parameter element in a list.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define from_param_add(header,name,value)      generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in a From element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define from_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Find the tag parameter in a From element.
 * @param header The element to work on.
 * @param dest A pointer on the element found.
 */
#define from_get_tag(header,dest)    generic_param_getbyname((header)->gen_params, "tag",dest)
/**
 * Allocate and add a tag parameter element in a Contact element.
 * @param header The element to work on.
 * @param value The token value.
 */
#define from_set_tag(header,value)     generic_param_add((header)->gen_params, sgetcopy("tag"),value)

#ifndef DOXYGEN			/* avoid DOXYGEN warning */
/* Compare the username, host and tag part (if exist) of the two froms */
  int from_compare (from_t * header1, from_t * header2);
#endif

/**
 * Allocate a Mime-Version element.
 * @param header The element to work on.
 */
#define mime_version_init(header)      content_length_init(header)
/**
 * Parse a Mime-Version element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define mime_version_parse(header, hvalue)  content_length_parse(header, hvalue)
/**
 * Get a string representation of a Mime-Version element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define mime_version_2char(header, dest)  content_length_2char(header, dest)
/**
 * Free a Mime-Version element.
 * @param header The element to work on.
 */
#define mime_version_free(header)      content_length_free(header)
/**
 * Clone a Mime-Version element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define mime_version_clone(header, dest)  content_length_clone(header, dest)

/**
 * Allocate a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_init(header)     www_authenticate_init(header)
/**
 * Parse a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define proxy_authenticate_parse(header, hvalue) www_authenticate_parse(header, hvalue)
/**
 * Get a string representation of a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define proxy_authenticate_2char(header, dest) www_authenticate_2char(header, dest)
/**
 * Free a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_free(header)     www_authenticate_free(header)
/**
 * Clone a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define proxy_authenticate_clone(header, dest) www_authenticate_clone(header, dest)

/**
 * Get value of the auth_type parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getauth_type(header)   www_authenticate_getauth_type(header)
/**
 * Add the auth_type parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setauth_type(header,value) www_authenticate_setauth_type(header, value)
/**
 * Get value of the realm parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getrealm(header)     www_authenticate_getrealm(header)
/**
 * Add the realm parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setrealm(header, value)  www_authenticate_setrealm(header, value)
/**
 * Get value of the domain parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getdomain(header)    www_authenticate_getdomain(header)
/**
 * Add the domain parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setdomain(header, value) www_authenticate_setdomain(header, value)
/**
 * Get value of the nonce parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getnonce(header)     www_authenticate_getnonce(header)
/**
 * Add the nonce parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setnonce(header, value)  www_authenticate_setnonce(header, value)
/**
 * Get value of the opaque parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getopaque(header)    www_authenticate_getopaque(header)
/**
 * Add the opaque parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setopaque(header, value) www_authenticate_setopaque(header, value)
/**
 * Get value of the stale parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getstale(header)     www_authenticate_getstale(header)
/**
 * Add the stale parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setstale(header, value)  www_authenticate_setstale(header, value)
/**
 * Add a stale parameter set to "true" in a proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_setstale_true(header) www_authenticate_setstale(header,sgetcopy("true"))
/**
 * Add a stale parameter set to "false" in a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_setstale_false(header) www_authenticate_setstale(header,sgetcopy("false"))
/**
 * Get value of the algorithm parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getalgorithm(header) www_authenticate_getalgorithm(header)
/**
 * Add the algorithm parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setalgorithm(header, value) www_authenticate_setalgorithm(header, value)
/**
 * Add the algorithm parameter set to "MD5" in a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_setalgorithm_MD5(header) www_authenticate_setalgorithm(header,sgetcopy("MD5"))
/**
 * Get value of the qop_options parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 */
#define proxy_authenticate_getqop_options(header) www_authenticate_getqop_options(header)
/**
 * Add the qop_options parameter from a Proxy-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authenticate_setqop_options(header,value) www_authenticate_setqop_options(header,value)


/**
 * Allocate a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_init(header)     authorization_init(header)
/**
 * Parse a Proxy-Authorization element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
#define proxy_authorization_parse(header, hvalue) authorization_parse(header, hvalue)
/**
 * Get a string representation of a Proxy-Authorization element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
#define proxy_authorization_2char(header, dest) authorization_2char(header, dest)
/**
 * Free a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_free(header)     authorization_free(header)
/**
 * Clone a Proxy-Authorization element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define proxy_authorization_clone(header, dest) authorization_clone(header, dest)

/**
 * Get value of the auth_type parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getauth_type(header)    authorization_getauth_type(header)
/**
 * Add the auth_type parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setauth_type(header, value) authorization_setauth_type(header, value)
/**
 * Get value of the username parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getusername(header)    authorization_getusername(header)
/**
 * Add the username parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setusername(header, value) authorization_setusername(header, value)
/**
 * Get value of the realm parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getrealm(header)       authorization_getrealm(header)
/**
 * Add the realm parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setrealm(header, value)    authorization_setrealm(header, value)
/**
 * Get value of the nonce parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getnonce(header)       authorization_getnonce(header)
/**
 * Add the nonce parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setnonce(header, value)    authorization_setnonce(header, value)
/**
 * Get value of the uri parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_geturi(header)         authorization_geturi(header)
/**
 * Add the uri parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_seturi(header, value)      authorization_seturi(header, value)
/**
 * Get value of the response parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getresponse(header)    authorization_getresponse(header)
/**
 * Add the response parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setresponse(header, value) authorization_setresponse(header, value)
/**
 * Get value of the digest parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getdigest(header)      authorization_getdigest(header)
/**
 * Add the digest parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setdigest(header, value)   authorization_setdigest(header, value)
/**
 * Get value of the algorithm parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getalgorithm(header)   authorization_getalgorithm(header)
/**
 * Add the algorithm parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setalgorithm(header,value) authorization_setalgorithm(header,value)
/**
 * Get value of the cnonce parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getcnonce(header)      authorization_getcnonce(header)
/**
 * Add the cnonce parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setcnonce(header, value)   authorization_setcnonce(header, value)
/**
 * Get value of the opaque parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getopaque(header)      authorization_getopaque(header)
/**
 * Add the opaque parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setopaque(header, value)   authorization_setopaque(header, value)
/**
 * Get value of the message_qop parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getmessage_qop(header) authorization_getmessage_qop(header)
/**
 * Add the message_qop parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setmessage_qop(header, value) authorization_setmessage_qop(header, value)
/**
 * Get value of the nonce_count parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 */
#define proxy_authorization_getnonce_count(header) authorization_getnonce_count(header)
/**
 * Add the nonce_count parameter from a Proxy-Authorization element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
#define proxy_authorization_setnonce_count(header, value) authorization_setnonce_count(header, value)


/**
 * Allocate a Record-Route element.
 * @param header The element to work on.
 */
  int record_route_init (record_route_t ** header);
/**
 * Free a Record-Route element.
 * @param header The element to work on.
 */
  void record_route_free (record_route_t * header);
/**
 * Parse a Record-Route element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int record_route_parse (record_route_t * header, char *hvalue);
/**
 * Get a string representation of a Record-Route element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int record_route_2char (record_route_t * header, char **dest);
/**
 * Clone a Record-Route element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define record_route_clone(header,dest)      from_clone(header,dest)
/**
 * Set the url in the Record-Route element.
 * @param header The element to work on.
 * @param url The value of the element.
 */
#define record_route_seturl(header,url)      from_seturl((from_t*)header,url)
/**
 * Get the url from a Record-Route header.
 * @param header The element to work on.
 */
#define record_route_geturl(header)          from_geturl((from_t*)header)
/**
 * Get a header parameter from a Record-Route element.
 * @param header The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the element found.
 */
#define record_route_param_get(header,pos,dest)  from_param_get((from_t*)header,pos,dest)
/**
 * Allocate and add a generic parameter element in a list.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define record_route_param_add(header,name,value) generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in a Record-Route element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define record_route_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

#ifdef __VXWORKS_OS__
/* route_init is already defined somewhere on VXWORKS.. */
  int route_init2 (route_t ** header);
#else
/**
 * Allocate a Route element.
 * @param header The element to work on.
 */
  int route_init (route_t ** header);
#endif
/**
 * Free a Route element.
 * @param header The element to work on.
 */
  void route_free (route_t * header);
/**
 * Parse a Route element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int route_parse (route_t * header, char *hvalue);
/**
 * Get a string representation of a Route element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int route_2char (route_t * header, char **dest);
/**
 * Clone a Route element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
#define route_clone(header,dest)       from_clone(header,dest)
/**
 * Set the url in the Route element.
 * @param header The element to work on.
 * @param url The value of the element.
 */
#define route_seturl(header,url)    from_seturl((from_t*)header,url)
/**
 * Get the url from a Route header.
 * @param header The element to work on.
 */
#define route_geturl(header)        from_geturl((from_t*)header)
/**
 * Get a header parameter from a Route element.
 * @param header The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the element found.
 */
#define route_param_get(header,pos,dest) from_param_get((from_t*)header,pos,dest)
/**
 * Allocate and add a generic parameter element in a Route element.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define route_param_add(header,name,value)   generic_param_add((header)->gen_params,name,value)
/**
 * Find a header parameter in a Route element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define route_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)

/**
 * Allocate a To element.
 * @param header The element to work on.
 */
  int to_init (to_t ** header);
/**
 * Free a To element.
 * @param header The element to work on.
 */
  void to_free (to_t * header);
/**
 * Parse a To element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int to_parse (to_t * header, char *hvalue);
/**
 * Get a string representation of a To element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int to_2char (to_t * header, char **dest);
/**
 * Clone a To element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int to_clone (to_t * header, to_t ** dest);
/**
 * Set the displayname in the To element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
#define to_setdisplayname(header,value) from_setdisplayname((from_t*)header,value)
/**
 * Get the displayname from a To header.
 * @param header The element to work on.
 */
#define to_getdisplayname(header)       from_getdisplayname((from_t*)header)
/**
 * Set the url in the To element.
 * @param header The element to work on.
 * @param url The value of the element.
 */
#define to_seturl(header,url)         from_seturl((from_t*)header,url)
/**
 * Get the url from a To header.
 * @param header The element to work on.
 */
#define to_geturl(header)               from_geturl((from_t*)header)
/**
 * Get a header parameter from a To element.
 * @param header The element to work on.
 * @param pos The index of the element to get.
 * @param dest A pointer on the element found.
 */
#define to_param_get(header,pos,dest) from_param_get((from_t*)header,pos,dest)
/**
 * Find a header parameter in a To element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define to_param_getbyname(header,name,dest) generic_param_getbyname((header)->gen_params,name,dest)
/**
 * Allocate and add a generic parameter element in a list.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define to_param_add(header,name,value) generic_param_add((header)->gen_params,name,value)

/**
 * Allocate and add a tag parameter element in a list.
 * @param header The element to work on.
 * @param value The token value.
 */
#define to_set_tag(header,value) generic_param_add((header)->gen_params, sgetcopy("tag"),value)
/**
 * Find a tag parameter in a To element.
 * @param header The element to work on.
 * @param dest A pointer on the element found.
 */
#define to_get_tag(header,dest) generic_param_getbyname((header)->gen_params, "tag",dest)

#ifndef DOXYGEN			/* avoid DOXYGEN warning */
/* Compare the username, host and tag part of the two froms */
#define to_compare(header1, header2) from_compare((from_t *)header1, (from_t *)header2)
#endif


/**
 * Allocate a Via element.
 * @param header The element to work on.
 */
  int via_init (via_t ** header);
/**
 * Free a Via element.
 * @param header The element to work on.
 */
  void via_free (via_t * header);
/**
 * Parse a Via element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int via_parse (via_t * header, char *hvalue);
/**
 * Get a string representation of a Via element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int via_2char (via_t * header, char **dest);
/**
 * Clone a Via element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int via_clone (via_t * header, via_t ** dest);
/**
 * Set the SIP version in the Via element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void via_setversion (via_t * header, char *value);
/**
 * Get the SIP version from a Via header.
 * @param header The element to work on.
 */
  char *via_getversion (via_t * header);
/**
 * Set the protocol in the Via element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void via_setprotocol (via_t * header, char *value);
/**
 * Get the protocol from a Via header.
 * @param header The element to work on.
 */
  char *via_getprotocol (via_t * header);
/**
 * Set the host in the Via element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void via_sethost (via_t * header, char *value);
/**
 * Get the host from a Via header.
 * @param header The element to work on.
 */
  char *via_gethost (via_t * header);
/**
 * Set the port in the Via element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void via_setport (via_t * header, char *value);
/**
 * Get the port from a Via header.
 * @param header The element to work on.
 */
  char *via_getport (via_t * header);
/**
 * Set the comment in the Via element.
 * @param header The element to work on.
 * @param value The value of the element.
 */
  void via_setcomment (via_t * header, char *value);
/**
 * Get the comment from a Via header.
 * @param header The element to work on.
 */
  char *via_getcomment (via_t * header);

/**
 * Allocate and add a hidden parameter element in a list.
 * @param header The element to work on.
 */
#define via_set_hidden(header)    generic_param_add((header)->via_params,sgetcopy("hidden"),NULL)
/**
 * Allocate and add a ttl parameter element in a list.
 * @param header The element to work on.
 * @param value The token value.
 */
#define via_set_ttl(header,value)   generic_param_add((header)->via_params,sgetcopy("ttl"),value)
/**
 * Allocate and add a maddr parameter element in a list.
 * @param header The element to work on.
 * @param value The token value.
 */
#define via_set_maddr(header,value)   generic_param_add((header)->via_params,sgetcopy("maddr"),value)
/**
 * Allocate and add a received parameter element in a list.
 * @param header The element to work on.
 * @param value The token value.
 */
#define via_set_received(header,value) generic_param_add((header)->via_params,sgetcopy("received"),value)
/**
 * Allocate and add a branch parameter element in a list.
 * @param header The element to work on.
 * @param value The token value.
 */
#define via_set_branch(header,value)  generic_param_add((header)->via_params,sgetcopy("branch"),value)

/**
 * Allocate and add a generic parameter element in a list.
 * @param header The element to work on.
 * @param name The token name.
 * @param value The token value.
 */
#define via_param_add(header,name,value)      generic_param_add((header)->via_params,name,value)
/**
 * Find a header parameter in a Via element.
 * @param header The element to work on.
 * @param name The token name to search.
 * @param dest A pointer on the element found.
 */
#define via_param_getbyname(header,name,dest) generic_param_getbyname((header)->via_params,name,dest)


/**
 * Allocate a Www-Authenticate element.
 * @param header The element to work on.
 */
  int www_authenticate_init (www_authenticate_t ** header);
/**
 * Parse a Www-Authenticate element.
 * @param header The element to work on.
 * @param hvalue The string to parse.
 */
  int www_authenticate_parse (www_authenticate_t * header, char *hvalue);
/**
 * Get a string representation of a Www-Authenticate element.
 * @param header The element to work on.
 * @param dest A pointer on the new allocated string.
 */
  int www_authenticate_2char (www_authenticate_t * header, char **dest);
/**
 * Free a Www-Authenticate element.
 * @param header The element to work on.
 */
  void www_authenticate_free (www_authenticate_t * header);
/**
 * Clone a Www-Authenticate element.
 * @param header The element to work on.
 * @param dest A pointer on the copy of the element.
 */
  int www_authenticate_clone (www_authenticate_t * header,
			      www_authenticate_t ** dest);

/**
 * Get value of the auth_type parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getauth_type (www_authenticate_t * header);
/**
 * Add the auth_type parameter from a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setauth_type (www_authenticate_t * header,
				      char *value);
/**
 * Get value of the realm parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getrealm (www_authenticate_t * header);
/**
 * Add the realm parameter from a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setrealm (www_authenticate_t * header, char *value);
/**
 * Get value of the domain parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getdomain (www_authenticate_t * header);
/**
 * Add the domain parameter from a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setdomain (www_authenticate_t * header, char *value);
/**
 * Get value of the nonce parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getnonce (www_authenticate_t * header);
/**
 * Add the nonce parameter from a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setnonce (www_authenticate_t * header, char *value);
/**
 * Get value of the opaque parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getopaque (www_authenticate_t * header);
/**
 * Add the opaque parameter from a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setopaque (www_authenticate_t * header, char *value);
/**
 * Get value of the stale parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getstale (www_authenticate_t * header);
/**
 * Add the stale parameter in a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setstale (www_authenticate_t * header, char *value);
/**
 * Add a stale parameter set to "true" in a Www-Authenticate element.
 * @param header The element to work on.
 */
#define www_authenticate_setstale_true(header) www_authenticate_setstale(header,sgetcopy("true"))
/**
 * Add a stale parameter set to "false" in a Www-Authenticate element.
 * @param header The element to work on.
 */
#define www_authenticate_setstale_false(header) www_authenticate_setstale(header,sgetcopy("false"))
/**
 * Get value of the algorithm parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getalgorithm (www_authenticate_t * header);
/**
 * Add the algorithm parameter in a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setalgorithm (www_authenticate_t * header,
				      char *value);
/**
 * Add the algorithm parameter set to "MD5" in a Www-Authenticate element.
 * @param header The element to work on.
 */
#define www_authenticate_setalgorithm_MD5(header) www_authenticate_setalgorithm(header,sgetcopy("MD5"))
/**
 * Get value of the qop_options parameter from a Www-Authenticate element.
 * @param header The element to work on.
 */
  char *www_authenticate_getqop_options (www_authenticate_t * header);
/**
 * Add the qop_options parameter from a Www-Authenticate element.
 * @param header The element to work on.
 * @param value The value of the new parameter.
 */
  void www_authenticate_setqop_options (www_authenticate_t * header,
					char *value);


/* trace facilities */
#ifndef DOXYGEN			/* avoid DOXYGEN warning */
#ifdef ENABLE_TRACE
  void msg_logrequest (sip_t * sip, char *fmt);
  void msg_logresponse (sip_t * sip, char *fmt);
#else
  #define msg_logrequest(P,Q) ;
  #define msg_logresponse(P,Q) ;
#endif
#endif


/**
 * Allocate and Add a new Date header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setdate(sipmsg,value)            msg_setheader((sip_t *)sipmsg,(char *)"date",value)
/**
 * Find a Date header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getdate(sipmsg,pos,dest)          msg_header_getbyname(( sip_t *)sipmsg,"date",pos,(header_t **)dest)
/**
 * Allocate and Add a new Encryption header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setencryption(sipmsg,value)      msg_setheader((sip_t *)sipmsg,(char *)"encryption",value)
/**
 * Find an Encryption header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getencryption(sipmsg,pos,dest)    msg_header_getbyname(( sip_t *)sipmsg,"encryption",pos,(header_t **)dest)
/**
 * Allocate and Add a new Organization header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setorganization(sipmsg,value)    msg_setheader((sip_t *)sipmsg,(char *)"organization",value)
/**
 * Find an Organization header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getorganization(sipmsg,pos,dest)  msg_header_getbyname(( sip_t *)sipmsg,"organization",pos,(header_t **)dest)
/**
 * Allocate and Add a new Require header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setrequire(sipmsg,value)         msg_setheader((sip_t *)sipmsg,(char *)"require",value)
/**
 * Find a Require header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getrequire(sipmsg,pos,dest)       msg_header_getbyname(( sip_t *)sipmsg,"require",pos,(header_t **)dest)
/**
 * Allocate and Add a new Supported header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setsupported(sipmsg,value)       msg_setheader((sip_t *)sipmsg,(char *)"supported",value)
/**
 * Find a Supported header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getsupported(sipmsg,pos,dest)     msg_header_getbyname(( sip_t *)sipmsg,"supported",pos,(header_t **)dest)
/**
 * Allocate and Add a new Timestamp header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_settimestamp(sipmsg,value)       msg_setheader((sip_t *)sipmsg,(char *)"timestamp",value)
/**
 * Find a Timestamp header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_gettimestamp(sipmsg,pos,dest)     msg_header_getbyname(( sip_t *)sipmsg,"timestamp",pos,(header_t **)dest)
/**
 * Allocate and Add a new User-Agent header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setuser_agent(sipmsg,value)      msg_setheader((sip_t *)sipmsg,(char *)"user-agent",value)
/**
 * Find a User-Agent header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getuser_agent(sipmsg,pos,dest)    msg_header_getbyname(( sip_t *)sipmsg,"user-agent",pos,(header_t **)dest)
/**
 * Allocate and Add a new Content-Language header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setcontent_language(sipmsg,value) msg_setheader((sip_t *)sipmsg,(char *)"content-language",value)
/**
 * Find a Content-Language header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getcontent_language(sipmsg,pos,dest) msg_header_getbyname(( sip_t *)sipmsg,"content-language",pos,(header_t **)dest)
/**
 * Allocate and Add a new Expires header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setexpires(sipmsg,value)         msg_setheader((sip_t *)sipmsg,(char *)"expires",value)
/**
 * Find a Expires header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getexpires(sipmsg,pos,dest)       msg_header_getbyname(( sip_t *)sipmsg,"expires",pos,(header_t **)dest)
/**
 * Allocate and Add a new In-Reply-To header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setin_reply_to(sipmsg,value)     msg_setheader((sip_t *)sipmsg,(char *)"in-reply-to",value)
/**
 * Find a In-Reply-To header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getin_reply_to(sipmsg,pos,dest)   msg_header_getbyname(( sip_t *)sipmsg,"in-reply-to",pos,(header_t **)dest)
/**
 * Allocate and Add a new Max-Forward header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setmax_forward(sipmsg,value)     msg_setheader((sip_t *)sipmsg,(char *)"max-forwards",value)
#define msg_setmax_forwards(sipmsg,value)     msg_setheader((sip_t *)sipmsg,(char *)"max-forwards",value)
/**
 * Find a Max-Forward header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getmax_forward(sipmsg,pos,dest)   msg_header_getbyname(( sip_t *)sipmsg,"max-forwards",pos,(header_t **)dest)
#define msg_getmax_forwards(sipmsg,pos,dest)   msg_header_getbyname(( sip_t *)sipmsg,"max-forwards",pos,(header_t **)dest)
/**
 * Allocate and Add a new Priority header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setpriority(sipmsg,value)        msg_setheader((sip_t *)sipmsg,(char *)"priority",value)
/**
 * Find a Priority header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getpriority(sipmsg,pos,dest)      msg_header_getbyname(( sip_t *)sipmsg,"priority",pos,(header_t **)dest)
/**
 * Allocate and Add a new Proxy-Require header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setproxy_require(sipmsg,value)   msg_setheader((sip_t *)sipmsg,(char *)"proxy-require",value)
/**
 * Find a Proxy-Require header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getproxy_require(sipmsg,pos,dest) msg_header_getbyname(( sip_t *)sipmsg,"proxy-require",pos,(header_t **)dest)
/**
 * Allocate and Add a new Response-Key header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setresponse_key(sipmsg,value)    msg_setheader((sip_t *)sipmsg,(char *)"response-key",value)
/**
 * Find a Response-Key header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getresponse_key(sipmsg,pos,dest)  msg_header_getbyname(( sip_t *)sipmsg,"response-key",pos,(header_t **)dest)
/**
 * Allocate and Add a new Subject header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setsubject(sipmsg,value)         msg_setheader((sip_t *)sipmsg,(char *)"subject",value)
/**
 * Find a Subject header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getsubject(sipmsg,pos,dest)       msg_header_getbyname(( sip_t *)sipmsg,"subject",pos,(header_t **)dest)
/**
 * Allocate and Add a new Retry-After header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setretry_after(sipmsg,value)     msg_setheader((sip_t *)sipmsg,(char *)"retry-after",value)
/**
 * Find a Retry-After header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getretry_after(sipmsg,pos,dest)   msg_header_getbyname(( sip_t *)sipmsg,"retry-after",pos,(header_t **)dest)
/**
 * Allocate and Add a new Server header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setserver(sipmsg,value)          msg_setheader((sip_t *)sipmsg,(char *)"server",value)
/**
 * Find a Server header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getserver(sipmsg,pos,dest)        msg_header_getbyname(( sip_t *)sipmsg,"server",pos,(header_t **)dest)
/**
 * Allocate and Add a new Unsupported header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setunsupported(sipmsg,value)     msg_setheader((sip_t *)sipmsg,(char *)"unsupported",value)
/**
 * Find a Unsupported header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getunsupported(sipmsg,pos,dest)   msg_header_getbyname(( sip_t *)sipmsg,"unsupported",pos,(header_t **)dest)
/**
 * Allocate and Add a new Warning header.
 * @param sipmsg The element to work on.
 * @param value the value of the new header.
 */
#define msg_setwarning(sipmsg,value)         msg_setheader((sip_t *)sipmsg,(char *)"warning",value)
/**
 * Find a Warning header.
 * @param sipmsg The element to work on.
 * @param pos The index of the header in the list of unknown header.
 * @param dest A pointer on the element found.
 */
#define msg_getwarning(sipmsg,pos,dest)       msg_header_getbyname(( sip_t *)sipmsg,"warning",pos,(header_t **)dest)

/** @} */


#ifdef __cplusplus
}
#endif

#endif