This file is indexed.

/usr/include/pjsip/sip_msg.h is in libpjproject-dev 2.7.2~dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
/* $Id: sip_msg.h 4700 2014-01-02 01:25:22Z ming $ */
/* 
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 */
#ifndef __PJSIP_SIP_MSG_H__
#define __PJSIP_SIP_MSG_H__

/**
 * @file pjsip/sip_msg.h
 * @brief SIP Message Structure.
 */

#include <pjsip/sip_types.h>
#include <pjsip/sip_uri.h>
#include <pj/list.h>

PJ_BEGIN_DECL

/**
 * @defgroup PJSIP_MSG Messaging Elements
 * @ingroup PJSIP_CORE
 * @brief Various SIP message elements such as methods, headers, URIs, etc.
 * @{
 */

/* **************************************************************************/
/**
 * @defgroup PJSIP_MSG_METHOD Methods
 * @brief Method names and manipulation.
 * @ingroup PJSIP_MSG
 * @{
 */

/**
 * This enumeration declares SIP methods as described by RFC3261. Additional
 * methods do exist, and they are described by corresponding RFCs for the SIP
 * extentensions. Since they won't alter the characteristic of the processing
 * of the message, they don't need to be explicitly mentioned here.
 */
typedef enum pjsip_method_e
{
    PJSIP_INVITE_METHOD,    /**< INVITE method, for establishing dialogs.   */
    PJSIP_CANCEL_METHOD,    /**< CANCEL method, for cancelling request.	    */
    PJSIP_ACK_METHOD,	    /**< ACK method.				    */
    PJSIP_BYE_METHOD,	    /**< BYE method, for terminating dialog.	    */
    PJSIP_REGISTER_METHOD,  /**< REGISTER method.			    */
    PJSIP_OPTIONS_METHOD,   /**< OPTIONS method.			    */

    PJSIP_OTHER_METHOD	    /**< Other method.				    */

} pjsip_method_e;



/**
 * This structure represents a SIP method.
 * Application must always use either #pjsip_method_init or #pjsip_method_set
 * to make sure that method name is initialized correctly. This way, the name
 * member will always contain a valid method string regardless whether the ID
 * is recognized or not.
 */
struct pjsip_method
{
    pjsip_method_e id;	    /**< Method ID, from \a pjsip_method_e. */
    pj_str_t	   name;    /**< Method name, which will always contain the 
			         method string. */
};


/*
 * For convenience, standard method structures are defined in the library.
 */
/** INVITE method constant. @see pjsip_get_invite_method() */
PJ_DECL_DATA(const pjsip_method) pjsip_invite_method;

/** CANCEL method constant. @see pjsip_get_cancel_method() */
PJ_DECL_DATA(const pjsip_method) pjsip_cancel_method;

/** ACK method constant. @see pjsip_get_ack_method() */
PJ_DECL_DATA(const pjsip_method) pjsip_ack_method;

/** BYE method constant. @see pjsip_get_bye_method() */
PJ_DECL_DATA(const pjsip_method) pjsip_bye_method;

/** REGISTER method constant. @see pjsip_get_register_method() */
PJ_DECL_DATA(const pjsip_method) pjsip_register_method;

/** OPTIONS method constant. @see pjsip_get_options_method() */
PJ_DECL_DATA(const pjsip_method) pjsip_options_method;

/*
 * Accessor functions for standard SIP methods.
 */
/** Get INVITE method constant. */
PJ_DECL(const pjsip_method*) pjsip_get_invite_method(void);
/** Get CANCEL method constant. */
PJ_DECL(const pjsip_method*) pjsip_get_cancel_method(void);
/** Get ACK method constant. */
PJ_DECL(const pjsip_method*) pjsip_get_ack_method(void);
/** Get BYE method constant. */
PJ_DECL(const pjsip_method*) pjsip_get_bye_method(void);
/** Get REGISTER method constant.*/
PJ_DECL(const pjsip_method*) pjsip_get_register_method(void);
/** Get OPTIONS method constant. */
PJ_DECL(const pjsip_method*) pjsip_get_options_method(void);


/*
 * Accessor functions
 */

/** 
 * Initialize the method structure from a string. 
 * This function will check whether the method is a known method then set
 * both the id and name accordingly.
 *
 * @param m	The method to initialize.
 * @param pool	Pool where memory allocation will be allocated from, if required.
 * @param str	The method string.
 */
PJ_DECL(void) pjsip_method_init( pjsip_method *m, 
				 pj_pool_t *pool, 
				 const pj_str_t *str);

/** 
 * Initialize the method structure from a string, without cloning the string.
 * See #pjsip_method_init.
 *
 * @param m	The method structure to be initialized.
 * @param str	The method string.
 */
PJ_DECL(void) pjsip_method_init_np( pjsip_method *m,
				    pj_str_t *str);

/** 
 * Set the method with the predefined method ID. 
 * This function will also set the name member of the structure to the correct
 * string according to the method.
 *
 * @param m	The method structure.
 * @param id	The method ID.
 */
PJ_DECL(void) pjsip_method_set( pjsip_method *m, pjsip_method_e id );


/** 
 * Copy one method structure to another. If the method is of the known methods,
 * then memory allocation is not required.
 *
 * @param pool	    Pool to allocate memory from, if required.
 * @param method    The destination method to copy to.
 * @param rhs	    The source method to copy from.
 */
PJ_DECL(void) pjsip_method_copy( pj_pool_t *pool,
				 pjsip_method *method,
				 const pjsip_method *rhs );

/** 
 * Compare one method with another, and conveniently determine whether the 
 * first method is equal, less than, or greater than the second method.
 *
 * @param m1	The first method.
 * @param m2	The second method.
 *
 * @return	Zero if equal, otherwise will return -1 if less or +1 if greater.
 */
PJ_DECL(int) pjsip_method_cmp( const pjsip_method *m1, const pjsip_method *m2);

/**
 * @}
 */

/* **************************************************************************/
/** 
 * @defgroup PJSIP_MSG_HDR Header Fields
 * @brief Declarations for various SIP header fields.
 * @ingroup PJSIP_MSG
 * @{
 */

/**
 * Header types, as defined by RFC3261.
 */
typedef enum pjsip_hdr_e
{
    /*
     * These are the headers documented in RFC3261. Headers not documented
     * there must have type PJSIP_H_OTHER, and the header type itself is 
     * recorded in the header name string.
     *
     * DO NOT CHANGE THE VALUE/ORDER OF THE HEADER IDs!!!.
     */
    PJSIP_H_ACCEPT,
    PJSIP_H_ACCEPT_ENCODING_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_ACCEPT_LANGUAGE_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_ALERT_INFO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_ALLOW,
    PJSIP_H_AUTHENTICATION_INFO_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_AUTHORIZATION,
    PJSIP_H_CALL_ID,
    PJSIP_H_CALL_INFO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_CONTACT,
    PJSIP_H_CONTENT_DISPOSITION_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_CONTENT_ENCODING_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_CONTENT_LANGUAGE_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_CONTENT_LENGTH,
    PJSIP_H_CONTENT_TYPE,
    PJSIP_H_CSEQ,
    PJSIP_H_DATE_UNIMP,			/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_ERROR_INFO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_EXPIRES,
    PJSIP_H_FROM,
    PJSIP_H_IN_REPLY_TO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_MAX_FORWARDS,
    PJSIP_H_MIME_VERSION_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_MIN_EXPIRES,
    PJSIP_H_ORGANIZATION_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_PRIORITY_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_PROXY_AUTHENTICATE,
    PJSIP_H_PROXY_AUTHORIZATION,
    PJSIP_H_PROXY_REQUIRE_UNIMP,	/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_RECORD_ROUTE,
    PJSIP_H_REPLY_TO_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_REQUIRE,
    PJSIP_H_RETRY_AFTER,
    PJSIP_H_ROUTE,
    PJSIP_H_SERVER_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_SUBJECT_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_SUPPORTED,
    PJSIP_H_TIMESTAMP_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_TO,
    PJSIP_H_UNSUPPORTED,
    PJSIP_H_USER_AGENT_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_VIA,
    PJSIP_H_WARNING_UNIMP,		/* N/A, use pjsip_generic_string_hdr */
    PJSIP_H_WWW_AUTHENTICATE,

    PJSIP_H_OTHER

} pjsip_hdr_e;

/**
 * This structure provides the pointer to basic functions that are needed
 * for generic header operations. All header fields will have pointer to
 * this structure, so that they can be manipulated uniformly.
 */
typedef struct pjsip_hdr_vptr
{
    /** 
     * Function to clone the header. 
     *
     * @param pool  Memory pool to allocate the new header.
     * @param hdr   Header to clone.
     *
     * @return A new instance of the header.
     */
    void *(*clone)(pj_pool_t *pool, const void *hdr);

    /** 
     * Pointer to function to shallow clone the header. 
     * Shallow cloning will just make a memory copy of the original header,
     * thus all pointers in original header will be kept intact. Because the
     * function does not need to perform deep copy, the operation should be
     * faster, but the application must make sure that the original header
     * is still valid throughout the lifetime of new header.
     *
     * @param pool  Memory pool to allocate the new header.
     * @param hdr   The header to clone.
     */
    void *(*shallow_clone)(pj_pool_t *pool, const void *hdr);

    /** Pointer to function to print the header to the specified buffer.
     *	Returns the length of string written, or -1 if the remaining buffer
     *	is not enough to hold the header.
     *
     *  @param hdr  The header to print.
     *  @param buf  The buffer.
     *  @param len  The size of the buffer.
     *
     *  @return	    The size copied to buffer, or -1 if there's not enough space.
     */
    int (*print_on)(void *hdr, char *buf, pj_size_t len);

} pjsip_hdr_vptr;


/**
 * Generic fields for all SIP headers are declared using this macro, to make
 * sure that all headers will have exactly the same layout in their start of
 * the storage. This behaves like C++ inheritance actually.
 */
#define PJSIP_DECL_HDR_MEMBER(hdr)   \
    /** List members. */	\
    PJ_DECL_LIST_MEMBER(hdr);	\
    /** Header type */		\
    pjsip_hdr_e	    type;	\
    /** Header name. */		\
    pj_str_t	    name;	\
    /** Header short name version. */	\
    pj_str_t	    sname;		\
    /** Virtual function table. */	\
    pjsip_hdr_vptr *vptr


/**
 * Generic SIP header structure, for generic manipulation for headers in the
 * message. All header fields can be typecasted to this type.
 */
struct pjsip_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_hdr);
};


/**
 * This generic function will clone any header, by calling "clone" function
 * in header's virtual function table.
 *
 * @param pool	    The pool to allocate memory from.
 * @param hdr	    The header to clone.
 *
 * @return	    A new instance copied from the original header.
 */
PJ_DECL(void*) pjsip_hdr_clone( pj_pool_t *pool, const void *hdr );


/**
 * This generic function will clone any header, by calling "shallow_clone" 
 * function in header's virtual function table.
 *
 * @param pool	    The pool to allocate memory from.
 * @param hdr	    The header to clone.
 *
 * @return	    A new instance copied from the original header.
 */
PJ_DECL(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr );

/**
 * This generic function will print any header, by calling "print" 
 * function in header's virtual function table.
 *
 * @param hdr  The header to print.
 * @param buf  The buffer.
 * @param len  The size of the buffer.
 *
 * @return	The size copied to buffer, or -1 if there's not enough space.
 */
PJ_DECL(int) pjsip_hdr_print_on( void *hdr, char *buf, pj_size_t len);

/**
 * @}
 */

/* **************************************************************************/
/**
 * @defgroup PJSIP_MSG_LINE Request and Status Line.
 * @brief Request and status line structures and manipulation.
 * @ingroup PJSIP_MSG
 * @{
 */

/**
 * This structure describes SIP request line.
 */
typedef struct pjsip_request_line 
{
    pjsip_method    method; /**< Method for this request line. */
    pjsip_uri *uri;    /**< URI for this request line. */
} pjsip_request_line;


/**
 * This structure describes SIP status line.
 */
typedef struct pjsip_status_line 
{
    int		code;	    /**< Status code. */
    pj_str_t	reason;	    /**< Reason string. */
} pjsip_status_line;


/**
 * This enumeration lists standard SIP status codes according to RFC 3261.
 * In addition, it also declares new status class 7xx for errors generated
 * by the stack. This status class however should not get transmitted on the 
 * wire.
 */
typedef enum pjsip_status_code
{
    PJSIP_SC_TRYING = 100,
    PJSIP_SC_RINGING = 180,
    PJSIP_SC_CALL_BEING_FORWARDED = 181,
    PJSIP_SC_QUEUED = 182,
    PJSIP_SC_PROGRESS = 183,

    PJSIP_SC_OK = 200,
    PJSIP_SC_ACCEPTED = 202,

    PJSIP_SC_MULTIPLE_CHOICES = 300,
    PJSIP_SC_MOVED_PERMANENTLY = 301,
    PJSIP_SC_MOVED_TEMPORARILY = 302,
    PJSIP_SC_USE_PROXY = 305,
    PJSIP_SC_ALTERNATIVE_SERVICE = 380,

    PJSIP_SC_BAD_REQUEST = 400,
    PJSIP_SC_UNAUTHORIZED = 401,
    PJSIP_SC_PAYMENT_REQUIRED = 402,
    PJSIP_SC_FORBIDDEN = 403,
    PJSIP_SC_NOT_FOUND = 404,
    PJSIP_SC_METHOD_NOT_ALLOWED = 405,
    PJSIP_SC_NOT_ACCEPTABLE = 406,
    PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED = 407,
    PJSIP_SC_REQUEST_TIMEOUT = 408,
    PJSIP_SC_GONE = 410,
    PJSIP_SC_REQUEST_ENTITY_TOO_LARGE = 413,
    PJSIP_SC_REQUEST_URI_TOO_LONG = 414,
    PJSIP_SC_UNSUPPORTED_MEDIA_TYPE = 415,
    PJSIP_SC_UNSUPPORTED_URI_SCHEME = 416,
    PJSIP_SC_BAD_EXTENSION = 420,
    PJSIP_SC_EXTENSION_REQUIRED = 421,
    PJSIP_SC_SESSION_TIMER_TOO_SMALL = 422,
    PJSIP_SC_INTERVAL_TOO_BRIEF = 423,
    PJSIP_SC_TEMPORARILY_UNAVAILABLE = 480,
    PJSIP_SC_CALL_TSX_DOES_NOT_EXIST = 481,
    PJSIP_SC_LOOP_DETECTED = 482,
    PJSIP_SC_TOO_MANY_HOPS = 483,
    PJSIP_SC_ADDRESS_INCOMPLETE = 484,
    PJSIP_AC_AMBIGUOUS = 485,
    PJSIP_SC_BUSY_HERE = 486,
    PJSIP_SC_REQUEST_TERMINATED = 487,
    PJSIP_SC_NOT_ACCEPTABLE_HERE = 488,
    PJSIP_SC_BAD_EVENT = 489,
    PJSIP_SC_REQUEST_UPDATED = 490,
    PJSIP_SC_REQUEST_PENDING = 491,
    PJSIP_SC_UNDECIPHERABLE = 493,

    PJSIP_SC_INTERNAL_SERVER_ERROR = 500,
    PJSIP_SC_NOT_IMPLEMENTED = 501,
    PJSIP_SC_BAD_GATEWAY = 502,
    PJSIP_SC_SERVICE_UNAVAILABLE = 503,
    PJSIP_SC_SERVER_TIMEOUT = 504,
    PJSIP_SC_VERSION_NOT_SUPPORTED = 505,
    PJSIP_SC_MESSAGE_TOO_LARGE = 513,
    PJSIP_SC_PRECONDITION_FAILURE = 580,

    PJSIP_SC_BUSY_EVERYWHERE = 600,
    PJSIP_SC_DECLINE = 603,
    PJSIP_SC_DOES_NOT_EXIST_ANYWHERE = 604,
    PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE = 606,

    PJSIP_SC_TSX_TIMEOUT = PJSIP_SC_REQUEST_TIMEOUT,
    /*PJSIP_SC_TSX_RESOLVE_ERROR = 702,*/
    PJSIP_SC_TSX_TRANSPORT_ERROR = PJSIP_SC_SERVICE_UNAVAILABLE,

    /* This is not an actual status code, but rather a constant
     * to force GCC to use 32bit to represent this enum, since
     * we have a code in PJSUA-LIB that assigns an integer
     * to this enum (see pjsua_acc_get_info() function).
     */
    PJSIP_SC__force_32bit = 0x7FFFFFFF

} pjsip_status_code;

/**
 * Get the default status text for the status code.
 *
 * @param status_code	    SIP Status Code
 *
 * @return		    textual message for the status code.
 */ 
PJ_DECL(const pj_str_t*) pjsip_get_status_text(int status_code);

/**
 * This macro returns non-zero (TRUE) if the specified status_code is
 * in the same class as the code_class.
 *
 * @param status_code	The status code.
 * @param code_class	The status code in the class (for example 100, 200).
 */
#define PJSIP_IS_STATUS_IN_CLASS(status_code, code_class)    \
	    (status_code/100 == code_class/100)

/**
 * @}
 */

/* **************************************************************************/
/**
 * @addtogroup PJSIP_MSG_MEDIA Media/MIME Type
 * @brief Media/MIME type declaration and manipulations.
 * @ingroup PJSIP_MSG
 * @{
 */

/**
 * This structure describes SIP media type, as used for example in 
 * Accept and Content-Type header..
 */
typedef struct pjsip_media_type
{
    pj_str_t type;	    /**< Media type. */
    pj_str_t subtype;	    /**< Media subtype. */
    pjsip_param param;	    /**< Media type parameters */
} pjsip_media_type;


/**
 * Initialize the media type with the specified type and subtype string.
 *
 * @param mt		The media type.
 * @param type		Optionally specify the media type.
 * @param subtype	Optionally specify the media subtype.
 */
PJ_DECL(void) pjsip_media_type_init(pjsip_media_type *mt,
				    pj_str_t *type,
				    pj_str_t *subtype);

/**
 * Initialize the media type with the specified type and subtype string.
 *
 * @param mt		The media type.
 * @param type		Optionally specify the media type.
 * @param subtype	Optionally specify the media subtype.
 */
PJ_DECL(void) pjsip_media_type_init2(pjsip_media_type *mt,
				     char *type,
				     char *subtype);

/**
 * Compare two media types.
 *
 * @param mt1		The first media type.
 * @param mt2		The second media type.
 * @param cmp_param	Specify how to compare the media type parameters:
 * 			 - 0: do not compare parameters
 * 			 - 1: compare parameters but ignore parameters that
 * 			      only appear in one of the media type.
 * 			 - 2: compare the parameters.
 *
 * @return		Zero if both media types are equal, -1 if mt1 < mt2,
 * 			1 if mt1 > mt2.
 */
PJ_DECL(int) pjsip_media_type_cmp(const pjsip_media_type *mt1,
				  const pjsip_media_type *mt2,
				  int cmp_param);

/**
 * Copy SIP media type to another.
 *
 * @param pool	    Pool to duplicate strings.
 * @param dst	    Destination structure.
 * @param src	    Source structure.
 */
PJ_DECL(void) pjsip_media_type_cp(pj_pool_t *pool,
				  pjsip_media_type *dst,
				  const pjsip_media_type *src);

/**
 * Print media type to the specified buffer.
 *
 * @param buf		Destination buffer.
 * @param len		Length of the buffer.
 * @param mt		The media type to be printed.
 *
 * @return		The number of characters printed to the buffer, or -1
 * 			if there's not enough space in the buffer.
 */
PJ_DECL(int) pjsip_media_type_print(char *buf, unsigned len,
				    const pjsip_media_type *mt);

/**
 * @}
 */

/* **************************************************************************/
/**
 * @addtogroup PJSIP_MSG_BODY Message Body
 * @brief SIP message body structures and manipulation.
 * @ingroup PJSIP_MSG
 * @{
 */

/**
 * Generic abstraction to message body.
 * When an incoming message is parsed (pjsip_parse_msg()), the parser fills in
 * all members with the appropriate value. The 'data' and 'len' member will
 * describe portion of incoming packet which denotes the message body.
 * When application needs to attach message body to outgoing SIP message, it
 * must fill in all members of this structure. 
 */
struct pjsip_msg_body
{
    /** MIME content type. 
     *  For incoming messages, the parser will fill in this member with the
     *  content type found in Content-Type header.
     *
     *  For outgoing messages, application may fill in this member with
     *  appropriate value, because the stack will generate Content-Type header
     *  based on the value specified here.
     *
     *  If the content_type is empty, no Content-Type AND Content-Length header
     *  will be added to the message. The stack assumes that application adds
     *  these headers themselves.
     */
    pjsip_media_type content_type;

    /** Pointer to buffer which holds the message body data. 
     *  For incoming messages, the parser will fill in this member with the
     *  pointer to the body string.
     *
     *  When sending outgoing message, this member doesn't need to point to the
     *  actual message body string. It can be assigned with arbitrary pointer,
     *  because the value will only need to be understood by the print_body()
     *  function. The stack itself will not try to interpret this value, but
     *  instead will always call the print_body() whenever it needs to get the
     *  actual body string.
     */
    void *data;

    /** The length of the data. 
     *  For incoming messages, the parser will fill in this member with the
     *  actual length of message body.
     *
     *  When sending outgoing message, again just like the "data" member, the
     *  "len" member doesn't need to point to the actual length of the body 
     *  string.
     */
    unsigned len;

    /** Pointer to function to print this message body. 
     *  Application must set a proper function here when sending outgoing 
     *  message.
     *
     *  @param msg_body	    This structure itself.
     *  @param buf	    The buffer.
     *  @param size	    The buffer size.
     *
     *  @return		    The length of the string printed, or -1 if there is
     *			    not enough space in the buffer to print the whole
     *			    message body.
     */
    int (*print_body)(struct pjsip_msg_body *msg_body, 
		      char *buf, pj_size_t size);

    /** Clone the data part only of this message body. Note that this only
     *  duplicates the data part of the body instead of the whole message
     *  body. If application wants to duplicate the entire message body
     *  structure, it must call #pjsip_msg_body_clone().
     *
     *  @param pool	    Pool used to clone the data.
     *  @param data	    The data inside message body, to be cloned.
     *  @param len	    The length of the data.
     *
     *  @return		    New data duplicated from the original data.
     */
    void* (*clone_data)(pj_pool_t *pool, const void *data, unsigned len);

};

/**
 * General purpose function to textual data in a SIP body. Attach this function
 * in a SIP message body only if the data in pjsip_msg_body is a textual 
 * message ready to be embedded in a SIP message. If the data in the message
 * body is not a textual body, then application must supply a custom function
 * to print that body.
 *
 * @param msg_body	The message body.
 * @param buf		Buffer to copy the message body to.
 * @param size		The size of the buffer.
 *
 * @return		The length copied to the buffer, or -1.
 */
PJ_DECL(int) pjsip_print_text_body( pjsip_msg_body *msg_body, 
				    char *buf, pj_size_t size);

/**
 * General purpose function to clone textual data in a SIP body. Attach this
 * function as "clone_data" member of the SIP body only if the data type
 * is a text (i.e. C string, not pj_str_t), and the length indicates the
 * length of the text.
 *
 *  @param pool		Pool used to clone the data.
 *  @param data		Textual data.
 *  @param len		The length of the string.
 *
 *  @return		New text duplicated from the original text.
 */
PJ_DECL(void*) pjsip_clone_text_data( pj_pool_t *pool, const void *data,
				      unsigned len);


/**
 * Clone the message body in src_body to the dst_body. This will duplicate
 * the contents of the message body using the \a clone_data member of the
 * source message body.
 *
 * @param pool		Pool to use to duplicate the message body.
 * @param dst_body	Destination message body.
 * @param src_body	Source message body to duplicate.
 *
 * @return		PJ_SUCCESS on success.
 */
PJ_DECL(pj_status_t) pjsip_msg_body_copy( pj_pool_t *pool,
					  pjsip_msg_body *dst_body,
					  const pjsip_msg_body *src_body );
					   

/**
 * Create cloned message body. This will duplicate the contents of the message
 * body using the \a clone_data member of the source message body.
 *
 * @param pool		Pool to use to duplicate the message body.
 * @param body		Source message body to duplicate.
 *
 * @return		The cloned message body on successfull.
 */
PJ_DECL(pjsip_msg_body*) pjsip_msg_body_clone( pj_pool_t *pool,
					       const pjsip_msg_body *body );
					   

/**
 * Create a text message body. Use this function to create message body when
 * the content is a simple text. For non-text message body (e.g. 
 * pjmedia_sdp_session or pj_xml_node), application must construct the message
 * manually.
 *
 * @param pool		Pool to allocate message body and its contents.
 * @param type		MIME type (e.g. "text").
 * @param subtype	MIME subtype (e.g. "plain").
 * @param text		The text content to be put in the message body.
 *
 * @return		A new message body with the specified Content-Type and
 *			text.
 */
PJ_DECL(pjsip_msg_body*) pjsip_msg_body_create( pj_pool_t *pool,
					        const pj_str_t *type,
						const pj_str_t *subtype,
						const pj_str_t *text );

/**
 * @}
 */

/* **************************************************************************/
/**
 * @defgroup PJSIP_MSG_MSG Message Structure
 * @brief SIP message (request and response) structure and operations.
 * @ingroup PJSIP_MSG
 * @{
 */

/**
 * Message type (request or response).
 */
typedef enum pjsip_msg_type_e
{
    PJSIP_REQUEST_MSG,	    /**< Indicates request message. */
    PJSIP_RESPONSE_MSG	    /**< Indicates response message. */
} pjsip_msg_type_e;


/**
 * This structure describes a SIP message.
 */
struct pjsip_msg
{
    /** Message type (ie request or response). */
    pjsip_msg_type_e  type;

    /** The first line of the message can be either request line for request
     *	messages, or status line for response messages. It is represented here
     *  as a union.
     */
    union
    {
	/** Request Line. */
	struct pjsip_request_line   req;

	/** Status Line. */
	struct pjsip_status_line    status;
    } line;

    /** List of message headers. */
    pjsip_hdr hdr;

    /** Pointer to message body, or NULL if no message body is attached to
     *	this mesage. 
     */
    pjsip_msg_body *body;
};


/** 
 * Create new request or response message.
 *
 * @param pool	    The pool.
 * @param type	    Message type.
 * @return	    New message, or THROW exception if failed.
 */
PJ_DECL(pjsip_msg*)  pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type);


/**
 * Perform a deep clone of a SIP message.
 *
 * @param pool	    The pool for creating the new message.
 * @param msg	    The message to be duplicated.
 *
 * @return	    New message, which is duplicated from the original 
 *		    message.
 */
PJ_DECL(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *msg);


/** 
 * Find a header in the message by the header type.
 *
 * @param msg	    The message.
 * @param type	    The header type to find.
 * @param start	    The first header field where the search should begin.
 *		    If NULL is specified, then the search will begin from the
 *		    first header, otherwise the search will begin at the
 *		    specified header.
 *
 * @return	    The header field, or NULL if no header with the specified 
 *		    type is found.
 */
PJ_DECL(void*)  pjsip_msg_find_hdr( const pjsip_msg *msg, 
				    pjsip_hdr_e type, const void *start);

/** 
 * Find a header in the message by its name.
 *
 * @param msg	    The message.
 * @param name	    The header name to find.
 * @param start	    The first header field where the search should begin.
 *		    If NULL is specified, then the search will begin from the
 *		    first header, otherwise the search will begin at the
 *		    specified header.
 *
 * @return	    The header field, or NULL if no header with the specified 
 *		    type is found.
 */
PJ_DECL(void*)  pjsip_msg_find_hdr_by_name( const pjsip_msg *msg, 
					    const pj_str_t *name, 
					    const void *start);

/** 
 * Find a header in the message by its name and short name version.
 *
 * @param msg	    The message.
 * @param name	    The header name to find.
 * @param sname	    The short name version of the header name.
 * @param start	    The first header field where the search should begin.
 *		    If NULL is specified, then the search will begin from the
 *		    first header, otherwise the search will begin at the
 *		    specified header.
 *
 * @return	    The header field, or NULL if no header with the specified 
 *		    type is found.
 */
PJ_DECL(void*)  pjsip_msg_find_hdr_by_names(const pjsip_msg *msg, 
					    const pj_str_t *name, 
					    const pj_str_t *sname,
					    const void *start);

/** 
 * Find and remove a header in the message. 
 *
 * @param msg	    The message.
 * @param hdr	    The header type to find.
 * @param start	    The first header field where the search should begin,
 *		    or NULL to search from the first header in the message.
 *
 * @return	    The header field, or NULL if not found.
 */
PJ_DECL(void*)  pjsip_msg_find_remove_hdr( pjsip_msg *msg, 
					   pjsip_hdr_e hdr, void *start);

/** 
 * Add a header to the message, putting it last in the header list.
 *
 * @param msg	    The message.
 * @param hdr	    The header to add.
 *
 * @bug Once the header is put in a list (or message), it can not be put in 
 *      other list (or message). Otherwise Real Bad Thing will happen.
 */
PJ_INLINE(void) pjsip_msg_add_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
{
    pj_list_insert_before(&msg->hdr, hdr);
}

/** 
 * Add header field to the message, putting it in the front of the header list.
 *
 * @param msg	The message.
 * @param hdr	The header to add.
 *
 * @bug Once the header is put in a list (or message), it can not be put in 
 *      other list (or message). Otherwise Real Bad Thing will happen.
 */
PJ_INLINE(void) pjsip_msg_insert_first_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
{
    pj_list_insert_after(&msg->hdr, hdr);
}

/** 
 * Print the message to the specified buffer. 
 *
 * @param msg	The message to print.
 * @param buf	The buffer
 * @param size	The size of the buffer.
 *
 * @return	The length of the printed characters (in bytes), or NEGATIVE
 *		value if the message is too large for the specified buffer.
 */
PJ_DECL(pj_ssize_t) pjsip_msg_print(const pjsip_msg *msg, 
				    char *buf, pj_size_t size);


/*
 * Some usefull macros to find common headers.
 */


/**
 * Find Call-ID header.
 *
 * @param msg	The message.
 * @return	Call-ID header instance.
 */
#define PJSIP_MSG_CID_HDR(msg) \
	    ((pjsip_cid_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL))

/**
 * Find CSeq header.
 *
 * @param msg	The message.
 * @return	CSeq header instance.
 */
#define PJSIP_MSG_CSEQ_HDR(msg) \
	    ((pjsip_cseq_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL))

/**
 * Find From header.
 *
 * @param msg	The message.
 * @return	From header instance.
 */
#define PJSIP_MSG_FROM_HDR(msg) \
	    ((pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL))

/**
 * Find To header.
 *
 * @param msg	The message.
 * @return	To header instance.
 */
#define PJSIP_MSG_TO_HDR(msg) \
	    ((pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL))


/**
 * @}
 */

/* **************************************************************************/
/**
 * @addtogroup PJSIP_MSG_HDR
 * @{
 */

/**
 * Generic SIP header, which contains hname and a string hvalue.
 * Note that this header is not supposed to be used as 'base' class for headers.
 */
typedef struct pjsip_generic_string_hdr
{
    /** Standard header field. */
    PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_string_hdr);
    /** hvalue */
    pj_str_t hvalue;
} pjsip_generic_string_hdr;


/**
 * Create a new instance of generic header. A generic header can have an
 * arbitrary header name.
 *
 * @param pool	    The pool.
 * @param hname	    The header name to be assigned to the header, or NULL to
 *		    assign the header name with some string.
 * @param hvalue    Optional string to be assigned as the value.
 *
 * @return	    The header, or THROW exception.
 */
PJ_DECL(pjsip_generic_string_hdr*) 
pjsip_generic_string_hdr_create( pj_pool_t *pool, 
				 const pj_str_t *hname,
				 const pj_str_t *hvalue);


/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param hname	    The header name to be assigned to the header, or NULL to
 *		    assign the header name with some string later.
 * @param hvalue    Optional string to be assigned as the value.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_generic_string_hdr*) 
pjsip_generic_string_hdr_init( pj_pool_t *pool,
			       void *mem,
			       const pj_str_t *hname,
			       const pj_str_t *hvalue);


/**
 * Construct a generic string header without allocating memory from the pool.
 * This function is useful to create a temporary header which life-time is
 * very short (for example, creating the header in the stack to be passed
 * as argument to a function which will copy the header).
 *
 * @param h	    The header to be initialized.
 * @param hname	    The header name to be assigned to the header, or NULL to
 *		    assign the header name with some string.
 * @param hvalue    Optional string to be assigned as the value.
 *
 * @return	    The header, or THROW exception.
 */
PJ_DECL(void) pjsip_generic_string_hdr_init2(pjsip_generic_string_hdr *h,
					     pj_str_t *hname,
					     pj_str_t *hvalue);


/* **************************************************************************/

/**
 * Generic SIP header, which contains hname and an integer ivalue.
 */
typedef struct pjsip_generic_int_hdr
{
    /** Standard header field. */
    PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_int_hdr);
    /** ivalue */
    pj_int32_t ivalue;
} pjsip_generic_int_hdr;


/**
 * Create a new instance of generic header. A generic header can have an
 * arbitrary header name.
 *
 * @param pool	    The pool.
 * @param hname	    The header name to be assigned to the header, or NULL to
 *		    assign the header name with some string.
 * @param hvalue    The value to be assigned to the header.
 *
 * @return	    The header, or THROW exception.
 */
PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool,
						      const pj_str_t *hname,
						      int hvalue );


/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param hname	    The header name to be assigned to the header, or NULL to
 *		    assign the header name with some string later.
 * @param value	    Value to be assigned to the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool,
							    void *mem,
							    const pj_str_t *hname,
							    int value );

/* **************************************************************************/

/** Maximum elements in the header array. */
#define PJSIP_GENERIC_ARRAY_MAX_COUNT	32

/**
 * Generic array of string header.
 */
typedef struct pjsip_generic_array_hdr
{
    /** Standard header fields. */
    PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_array_hdr);

    /** Number of tags/elements. */
    unsigned	count;

    /** Tags/elements. */
    pj_str_t	values[PJSIP_GENERIC_ARRAY_MAX_COUNT];

} pjsip_generic_array_hdr;

/**
 * Create generic array header.
 *
 * @param pool	    Pool to allocate memory from.
 * @param hname	    Header name.
 *
 * @return	    New generic array header.
 */
PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_create(pj_pool_t *pool,
							     const pj_str_t *hname);

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param hname	    The header name to be assigned to the header, or NULL to
 *		    assign the header name with some string later.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init(pj_pool_t *pool,
							       void *mem,
							       const pj_str_t *hname);


/* **************************************************************************/

/** Accept header. */
typedef pjsip_generic_array_hdr pjsip_accept_hdr;

/** Maximum fields in Accept header. */
#define PJSIP_MAX_ACCEPT_COUNT	PJSIP_GENERIC_ARRAY_MAX_COUNT

/**
 * Create new Accept header instance.
 *
 * @param pool	    The pool.
 *
 * @return	    New Accept header instance.
 */
PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool);

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool,
						  void *mem );


/* **************************************************************************/

/**
 * Allow header.
 */
typedef pjsip_generic_array_hdr pjsip_allow_hdr;

/**
 * Create new Allow header instance.
 *
 * @param pool	    The pool.
 *
 * @return	    New Allow header instance.
 */
PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool);



/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool,
						void *mem );

/* **************************************************************************/

/**
 * Call-ID header.
 */
typedef struct pjsip_cid_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_cid_hdr);
    pj_str_t id;	    /**< Call-ID string. */
} pjsip_cid_hdr;


/**
 * Create new Call-ID header.
 *
 * @param pool	The pool.
 *
 * @return	new Call-ID header.
 */
PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_create( pj_pool_t *pool );


/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool,
					    void *mem );



/* **************************************************************************/
/**
 * Content-Length header.
 */
typedef struct pjsip_clen_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_clen_hdr);
    int len;	/**< Content length. */
} pjsip_clen_hdr;

/**
 * Create new Content-Length header.
 *
 * @param pool	the pool.
 * @return	A new Content-Length header instance.
 */
PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool,
					      void *mem );


/* **************************************************************************/
/**
 * CSeq header.
 */
typedef struct pjsip_cseq_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_cseq_hdr);
    pj_int32_t	    cseq;	/**< CSeq number. */
    pjsip_method    method;	/**< CSeq method. */
} pjsip_cseq_hdr;


/** Create new  CSeq header. 
 *
 *  @param pool	The pool.
 *  @return A new CSeq header instance.
 */
PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool,
					      void *mem );

/* **************************************************************************/
/**
 * Contact header.
 * In this library, contact header only contains single URI. If a message has
 * multiple URI in the Contact header, the URI will be put in separate Contact
 * headers.
 */
typedef struct pjsip_contact_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_contact_hdr);
    int		    star;	    /**< The contact contains only a '*' character */
    pjsip_uri	   *uri;	    /**< URI in the contact. */
    int		    q1000;	    /**< The "q" value times 1000 (to avoid float) */
    pj_int32_t	    expires;	    /**< Expires parameter, otherwise -1 if not present. */
    pjsip_param	    other_param;    /**< Other parameters, concatenated in a single string. */
} pjsip_contact_hdr;


/**
 * Create a new Contact header.
 *
 * @param pool	The pool.
 * @return	A new instance of Contact header.
 */
PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool,
						    void *mem );


/* **************************************************************************/
/**
 * Content-Type.
 */
typedef struct pjsip_ctype_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_ctype_hdr);
    pjsip_media_type media; /**< Media type. */
} pjsip_ctype_hdr;


/**
 * Create a nwe Content Type header.
 *
 * @param pool	The pool.
 * @return	A new Content-Type header.
 */
PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool,
						void *mem );

/* **************************************************************************/
/** Expires header. */
typedef pjsip_generic_int_hdr pjsip_expires_hdr;

/**
 * Create a new Expires header.
 *
 * @param pool	    The pool.
 * @param value	    The expiration value.
 *
 * @return	    A new Expires header.
 */
PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool,
						      int value);

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param value	    The expiration value.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool,
						    void *mem,
						    int value );



/* **************************************************************************/
/**
 * To or From header.
 */
typedef struct pjsip_fromto_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_fromto_hdr);
    pjsip_uri	    *uri;	    /**< URI in From/To header. */
    pj_str_t	     tag;	    /**< Header "tag" parameter. */
    pjsip_param	     other_param;   /**< Other params, concatenated as a single string. */
} pjsip_fromto_hdr;

/** Alias for From header. */
typedef pjsip_fromto_hdr pjsip_from_hdr;

/** Alias for To header. */
typedef pjsip_fromto_hdr pjsip_to_hdr;

/**
 * Create a From header.
 *
 * @param pool	The pool.
 * @return	New instance of From header.
 */
PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool,
					      void *mem );

/**
 * Create a To header.
 *
 * @param pool	The pool.
 * @return	New instance of To header.
 */
PJ_DECL(pjsip_to_hdr*)   pjsip_to_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool,
					  void *mem );

/**
 * Convert the header to a From header.
 *
 * @param hdr	    The generic from/to header.
 * @return	    "From" header.
 */
PJ_DECL(pjsip_from_hdr*) pjsip_fromto_hdr_set_from( pjsip_fromto_hdr *hdr );

/**
 * Convert the header to a To header.
 *
 * @param hdr	    The generic from/to header.
 * @return	    "To" header.
 */
PJ_DECL(pjsip_to_hdr*)   pjsip_fromto_hdr_set_to( pjsip_fromto_hdr *hdr );


/* **************************************************************************/
/**
 * Max-Forwards header.
 */
typedef pjsip_generic_int_hdr pjsip_max_fwd_hdr;

/**
 * Create new Max-Forwards header instance.
 *
 * @param pool	    The pool.
 * @param value	    The Max-Forwards value.
 *
 * @return	    New Max-Forwards header instance.
 */
PJ_DECL(pjsip_max_fwd_hdr*) 
pjsip_max_fwd_hdr_create(pj_pool_t *pool, int value);


/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param value	    The Max-Forwards value.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_max_fwd_hdr*) 
pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, int value );


/* **************************************************************************/
/**
 * Min-Expires header.
 */
typedef pjsip_generic_int_hdr pjsip_min_expires_hdr;

/**
 * Create new Min-Expires header instance.
 *
 * @param pool	    The pool.
 * @param value	    The Min-Expires value.
 *
 * @return	    New Min-Expires header instance.
 */
PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool,
							     int value);


/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param value	    The Min-Expires value.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool,
							    void *mem,
							    int value );


/* **************************************************************************/
/**
 * Record-Route and Route headers.
 */
typedef struct pjsip_routing_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_routing_hdr);  /**< Generic header fields. */
    pjsip_name_addr  name_addr;	  /**< The URL in the Route/Record-Route header. */
    pjsip_param	     other_param; /**< Other parameter. */
} pjsip_routing_hdr;

/** Alias for Record-Route header. */
typedef pjsip_routing_hdr pjsip_rr_hdr;

/** Alias for Route header. */
typedef pjsip_routing_hdr pjsip_route_hdr;


/** 
 * Create new Record-Route header from the pool. 
 *
 * @param pool	The pool.
 * @return	A new instance of Record-Route header.
 */
PJ_DECL(pjsip_rr_hdr*)	    pjsip_rr_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool,
					  void *mem );

/** 
 * Create new Route header from the pool. 
 *
 * @param pool	The pool.
 * @return	A new instance of "Route" header.
 */
PJ_DECL(pjsip_route_hdr*)   pjsip_route_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool,
					        void *mem );

/** 
 * Convert generic routing header to Record-Route header. 
 *
 * @param r	The generic routing header, or a "Routing" header.
 * @return	Record-Route header.
 */
PJ_DECL(pjsip_rr_hdr*)	    pjsip_routing_hdr_set_rr( pjsip_routing_hdr *r );

/** 
 * Convert generic routing header to "Route" header. 
 *
 * @param r	The generic routing header, or a "Record-Route" header.
 * @return	"Route" header.
 */
PJ_DECL(pjsip_route_hdr*)   pjsip_routing_hdr_set_route( pjsip_routing_hdr *r );

/* **************************************************************************/
/**
 * Require header.
 */
typedef pjsip_generic_array_hdr pjsip_require_hdr;

/**
 * Create new Require header instance.
 *
 * @param pool	    The pool.
 *
 * @return	    New Require header instance.
 */
PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool);

/**
 * Initialize a preallocated memory with the header structure. This function
 * should only be called when application uses its own memory allocation to
 * allocate memory block for the specified header (e.g. in C++, when the 
 * header is allocated with "new" operator).
 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
 * which allocates memory and initialize it in one go.
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool,
						    void *mem );


/* **************************************************************************/
/**
 * Retry-After header.
 */
typedef struct pjsip_retry_after_hdr
{
    /** Standard header field. */
    PJSIP_DECL_HDR_MEMBER(struct pjsip_retry_after_hdr); 
    pj_int32_t	ivalue;		/**< Retry-After value	    */
    pjsip_param	param;		/**< Optional parameters    */
    pj_str_t	comment;	/**< Optional comments.	    */
} pjsip_retry_after_hdr;


/**
 * Create new Retry-After header instance.
 *
 * @param pool	    The pool.
 * @param value	    The Retry-After value.
 *
 * @return	    New Retry-After header instance.
 */
PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool,
							     int value);

/**
 * Initialize a preallocated memory with the header structure. 
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 * @param value	    The Retry-After value.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool,
							    void *mem,
							    int value );


/* **************************************************************************/
/**
 * Supported header.
 */
typedef pjsip_generic_array_hdr pjsip_supported_hdr;

/**
 * Create new Supported header instance.
 *
 * @param pool	    The pool.
 *
 * @return	    New Supported header instance.
 */
PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool);

/**
 * Initialize a preallocated memory with the header structure. 
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool,
							void *mem );

/* **************************************************************************/
/**
 * Unsupported header.
 */
typedef pjsip_generic_array_hdr pjsip_unsupported_hdr;

/**
 * Create new Unsupported header instance.
 *
 * @param pool	    The pool.
 *
 * @return	    New Unsupported header instance.
 */
PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool);

/**
 * Initialize a preallocated memory with the header structure. 
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool,
							    void *mem );

/* **************************************************************************/
/**
 * SIP Via header.
 * In this implementation, Via header can only have one element in each header.
 * If a message arrives with multiple elements in a single Via, then they will
 * be split up into multiple Via headers.
 */
typedef struct pjsip_via_hdr
{
    PJSIP_DECL_HDR_MEMBER(struct pjsip_via_hdr);
    pj_str_t	     transport;	    /**< Transport type. */
    pjsip_host_port  sent_by;	    /**< Host and optional port */
    int		     ttl_param;	    /**< TTL parameter, or -1 if it's not specified. */
    int		     rport_param;   /**< "rport" parameter, 0 to specify without
					 port number, -1 means doesn't exist. */
    pj_str_t	     maddr_param;   /**< "maddr" parameter. */
    pj_str_t	     recvd_param;   /**< "received" parameter. */
    pj_str_t	     branch_param;  /**< "branch" parameter. */
    pjsip_param	     other_param;   /**< Other parameters, concatenated as single string. */
    pj_str_t	     comment;	    /**< Comment. */
} pjsip_via_hdr;

/**
 * Create a new Via header.
 *
 * @param pool	    The pool.
 * @return	    A new "Via" header instance.
 */
PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_create( pj_pool_t *pool );

/**
 * Initialize a preallocated memory with the header structure. 
 *
 * @param pool	    Pool for additional memory allocation if required.
 * @param mem	    Pre-allocated memory to be initialized as the header.
 *
 * @return	    The header instance, which points to the same memory 
 *		    location as the mem argument.
 */
PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool,
					    void *mem );

/* **************************************************************************/
/**
 * SIP Warning header.
 * In this version, Warning header is just a typedef for generic string 
 * header.
 */
typedef pjsip_generic_string_hdr pjsip_warning_hdr;

/**
 * Create a warning header with the specified contents.
 *
 * @param pool	    Pool to allocate memory from.
 * @param code	    Warning code, 300-399.
 * @param host	    The host portion of the Warning header.
 * @param text	    The warning text, which MUST not be quoted with
 *		    double quote.
 *
 * @return	    The Warning header field.
 */
PJ_DECL(pjsip_warning_hdr*) pjsip_warning_hdr_create( pj_pool_t *pool,
						      int code,
						      const pj_str_t *host,
						      const pj_str_t *text);

/**
 * Create a warning header and initialize the contents from the error
 * message for the specified status code. The warning code will be
 * set to 399.
 *
 * @param pool	    Pool to allocate memory from.
 * @param host	    The host portion of the Warning header.
 * @param status    The error status code, which error text will be
 *		    put in as the Warning text.
 *
 * @return	    The Warning header field.
 */
PJ_DECL(pjsip_warning_hdr*) 
pjsip_warning_hdr_create_from_status( pj_pool_t *pool,
				      const pj_str_t *host,
				      pj_status_t status);

/* **************************************************************************/
/** Accept-Encoding header. */
typedef pjsip_generic_string_hdr pjsip_accept_encoding_hdr;

/** Create Accept-Encoding header. */
#define pjsip_accept_encoding_hdr_create pjsip_generic_string_hdr_create

/** Accept-Language header. */
typedef pjsip_generic_string_hdr pjsip_accept_lang_hdr;

/** Create Accept-Language header. */
#define pjsip_accept_lang_hdr_create pjsip_generic_string_hdr_create

/** Alert-Info header. */
typedef pjsip_generic_string_hdr pjsip_alert_info_hdr;

/** Create Alert-Info header. */
#define pjsip_alert_info_hdr_create pjsip_generic_string_hdr_create

/** Authentication-Info header. */
typedef pjsip_generic_string_hdr pjsip_auth_info_hdr;

/** Create Authentication-Info header. */
#define pjsip_auth_info_hdr_create pjsip_generic_string_hdr_create

/** Call-Info header. */
typedef pjsip_generic_string_hdr pjsip_call_info_hdr;

/** Create Call-Info header. */
#define pjsip_call_info_hdr_create pjsip_generic_string_hdr_create

/** Content-Disposition header. */
typedef pjsip_generic_string_hdr pjsip_content_disposition_hdr;

/** Create Content-Disposition header. */
#define pjsip_content_disposition_hdr_create pjsip_generic_string_hdr_create

/** Content-Encoding header. */
typedef pjsip_generic_string_hdr pjsip_content_encoding_hdr;

/** Create Content-Encoding header. */
#define pjsip_content_encoding_hdr_create pjsip_generic_string_hdr_create

/** Content-Language header. */
typedef pjsip_generic_string_hdr pjsip_content_lang_hdr;

/** Create Content-Language header. */
#define pjsip_content_lang_hdr_create pjsip_generic_string_hdr_create

/** Date header. */
typedef pjsip_generic_string_hdr pjsip_date_hdr;

/** Create Date header. */
#define pjsip_date_hdr_create pjsip_generic_string_hdr_create

/** Error-Info header. */
typedef pjsip_generic_string_hdr pjsip_err_info_hdr;

/** Create Error-Info header. */
#define pjsip_err_info_hdr_create pjsip_generic_string_hdr_create

/** In-Reply-To header. */
typedef pjsip_generic_string_hdr pjsip_in_reply_to_hdr;

/** Create In-Reply-To header. */
#define pjsip_in_reply_to_hdr_create pjsip_generic_string_hdr_create

/** MIME-Version header. */
typedef pjsip_generic_string_hdr pjsip_mime_version_hdr;

/** Create MIME-Version header. */
#define pjsip_mime_version_hdr_create pjsip_generic_string_hdr_create

/** Organization header. */
typedef pjsip_generic_string_hdr pjsip_organization_hdr;

/** Create Organization header. */
#define pjsip_organization_hdr_create pjsip_genric_string_hdr_create

/** Priority header. */
typedef pjsip_generic_string_hdr pjsip_priority_hdr;

/** Create Priority header. */
#define pjsip_priority_hdr_create pjsip_generic_string_hdr_create

/** Proxy-Require header. */
typedef pjsip_generic_string_hdr pjsip_proxy_require_hdr;

/** Reply-To header. */
typedef pjsip_generic_string_hdr pjsip_reply_to_hdr;

/** Create Reply-To header. */
#define pjsip_reply_to_hdr_create pjsip_generic_string_hdr_create

/** Server header. */
typedef pjsip_generic_string_hdr pjsip_server_hdr;

/** Create Server header. */
#define pjsip_server_hdr_create pjsip_generic_string_hdr_create

/** Subject header. */
typedef pjsip_generic_string_hdr pjsip_subject_hdr;

/** Create Subject header. */
#define pjsip_subject_hdr_create pjsip_generic_string_hdr_create

/** Timestamp header. */
typedef pjsip_generic_string_hdr pjsip_timestamp_hdr;

/** Create Timestamp header. */
#define pjsip_timestamp_hdr_create pjsip_generic_string_hdr_create

/** User-Agent header. */
typedef pjsip_generic_string_hdr pjsip_user_agent_hdr;

/** Create User-Agent header. */
#define pjsip_user_agent_hdr_create pjsip_generic_string_hdr_create


/**
 * @}
 */

/**
 * @}  PJSIP_MSG
 */


PJ_END_DECL

#endif	/* __PJSIP_SIP_MSG_H__ */