/
sip_msg.h
78 lines (67 loc) · 2.39 KB
/
sip_msg.h
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
/*
* Registrar specific SIP message processing
*
* Copyright (C) 2001-2003 FhG Fokus
* Copyright (C) 2016 OpenSIPS Solutions
*
* This file is part of opensips, a free SIP server.
*
* opensips 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
*
* opensips 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __LIB_REG_CONTACT__
#define __LIB_REG_CONTACT__
#include "../../parser/hf.h"
#include "../../dprint.h"
#include "../../parser/parse_expires.h"
#include "../../parser/contact/contact.h"
#include "../../ut.h"
#include "../../qvalue.h"
#define CONTACT_MAX_SIZE 255
#define RECEIVED_MAX_SIZE 255
/*! \brief
* Parse the whole message and bodies of all header fields
* that will be needed by registrar
*/
int parse_reg_headers(struct sip_msg* _m);
/*! \brief
* Extract Address Of Record
*/
int extract_aor(str* _uri, str* _a, str* sip_instance, str* call_id);
/*! \brief
* Check if the originating REGISTER message was formed correctly
* The whole message must be parsed before calling the function
* _s indicates whether the contact was star
*/
int check_contacts(struct sip_msg* _m, int* _s);
/*! \brief
* Calculate contact q value as follows:
* 1) If q parameter exist, use it
* 2) If the parameter doesn't exist, use default value
*/
extern qvalue_t default_q;
int calc_contact_q(param_t* _q, qvalue_t* _r);
/*! \brief
* Iterators through all Contact hf values of a SIP request
*
* Note: each pair of functions has a global state, so two pairs are
* provided in order to satisfy most nested iteration needs
*/
contact_t* get_first_contact(struct sip_msg* _m);
contact_t* get_next_contact(contact_t* _c);
void reset_first_contact(void);
contact_t* get_first_contact2(struct sip_msg* _m);
contact_t* get_next_contact2(contact_t* _c);
void reset_first_contact2(void);
#endif /* __LIB_REG_CONTACT__ */