# Structure

hdr_field

The structure represents a header field of a SIP message. A header field consist of name and body separated by a double colon. For example: "Server: SIP Express Router\r\n" is one header field. "Server" is header field name and "SI Express Router\r\n" is header field body.

The structure is defined in file `hf.h` under `parser` subdirectory.

Structure Declaration

    struct hdr_field {
        int type;                /* Header field type */
        str name;                /* Header field name */
        str body;                /* Header field body */
        void* parsed;            /* Parsed data structures */
        struct hdr_field* next;  /* Next header field in the list */
    };

Field Description:

- type - Type of the header field, the following header field types are defined (and recognized by the parser):

  HDR_VIA1, HDR_VIA2, HDR_TO, HDR_FROM, HDR_CSEQ, HDR_CALLID, HDR_CONTACT, HDR_MAXFORWARDS, HDR_ROUTE, HDR_RECORDROUTE, HDR_CONTENTTYPE, HDR_CONTENTLENGTH, HDR_AUTHORIZATION, HDR_EXPIRES, HDR_PROXYAUTH, HDR_WWWAUTH, HDR_SUPPORTED, HDR_REQUIRE, HDR_PROXYREQUIRE, HDR_UNSUPPORTED, HDR_ALLOW, HDR_EVENT, HDR_OTHER.

  Their meaning is self explanatory. HDR_OTHER marks header field not recognized by the parser.

- name - Name of the header field (the part before colon)

- body - body of the header field (the part after colon)

- parsed - Each header field body can be further parsed. The field contains pointer to parsed structure if the header field was parsed already. The pointer is of type `void*` because it can point to different types of structure depending on the header field type.

- next - Pointer to the next header field in linked list.