comparison libsip/parse.h @ 40:77d980126efd

libsip started with primary parsing function
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 04 Sep 2022 16:33:31 -0800
parents
children
comparison
equal deleted inserted replaced
39:64b9f0f90726 40:77d980126efd
1 /*
2 * Here we define the structure we are going to use for receiving
3 * and parsing SIP UDP packets.
4 */
5
6 #define MAX_SIP_RX_PACKET 3072
7 #define MAX_HEADER_FIELDS 64
8
9 struct sip_parse_hdr {
10 char *field_name;
11 char *field_value;
12 };
13
14 struct sip_pkt_rx {
15 /* recvfrom on UDP socket, input to parser */
16 char pkt_buffer[MAX_SIP_RX_PACKET];
17 unsigned pkt_length;
18 /* filled by parser */
19 int parse_msgtype;
20 char *req_method;
21 char *req_uri;
22 unsigned status_code;
23 char *status_str;
24 /* header fields */
25 struct sip_parse_hdr hdr_fields[MAX_HEADER_FIELDS];
26 unsigned num_hdr_fields;
27 /* optional message body */
28 char *msg_body;
29 unsigned msg_body_len;
30 };
31
32 #define SIP_MSG_TYPE_REQ 1
33 #define SIP_MSG_TYPE_RESP 2