annotate libsip/parse.h @ 155:2730ccb44549

sip-out: initial UAC response handling
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2022 23:30:00 -0800
parents 77d980126efd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Here we define the structure we are going to use for receiving
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * and parsing SIP UDP packets.
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #define MAX_SIP_RX_PACKET 3072
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #define MAX_HEADER_FIELDS 64
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 struct sip_parse_hdr {
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 char *field_name;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 char *field_value;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 };
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 struct sip_pkt_rx {
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 /* recvfrom on UDP socket, input to parser */
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 char pkt_buffer[MAX_SIP_RX_PACKET];
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 unsigned pkt_length;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /* filled by parser */
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 int parse_msgtype;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 char *req_method;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 char *req_uri;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 unsigned status_code;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 char *status_str;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /* header fields */
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 struct sip_parse_hdr hdr_fields[MAX_HEADER_FIELDS];
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 unsigned num_hdr_fields;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /* optional message body */
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 char *msg_body;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 unsigned msg_body_len;
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 };
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #define SIP_MSG_TYPE_REQ 1
77d980126efd libsip started with primary parsing function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #define SIP_MSG_TYPE_RESP 2