# Structure

via_body

The structure represents parsed Via header field. See file `parse_via.h` under `parser` subdirectory for more details.

    struct via_body {
        int error;
        str hdr;                      /* Contains "Via" or "v" */
        str name;
        str version;
        str transport;
        str host;
        int port;
        str port_str;
        str params;
        str comment;
        int bsize;                    /* body size, not including hdr */
        struct via_param* param_lst;  /* list of parameters*/
        struct via_param* last_param; /*last via parameter, internal use*/

        /* shortcuts to "important" params*/
        struct via_param* branch;
        struct via_param* received;

        struct via_body* next;        /* pointer to next via body string if
        compact via or null */
    };

Field Description:

- error - The field contains error code when the parser was unable to parse the header field.

- hdr- Header field name, it can be "Via" or "v" in this case.

- name - Protocol name ("SIP" in this case).

- version - Protocol version (for example "2.0").

- transport - Transport protocol name ("TCP", "UDP" and so on).

- host - Hostname or IP address contained in the Via header field.

- port - Port number as integer.

- port_str - Port number as string.

- params - Unparsed parameters (as one string containing all the parameters).

- comment - Comment.

- bsize - Size of the body (not including hdr).

- param_lst - Linked list of all parameters.

- last_param - Last parameter in the list.

- branch - Branch parameter.

- received - Received parameter.

- next - If the Via is in compact form (more Vias in the same header field), this field contains pointer to the next Via.