1 /*
2  * Header file for Enum and E164 related functions
3  *
4  * Copyright (C) 2002-2008 Juha Heinanen
5  *
6  * This file is part of Kamailio, a free SIP server.
7  *
8  * Kamailio is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version
12  *
13  * Kamailio is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22 /*!
23  * \file
24  * \brief SIP-router enum :: Header file for Enum and E164 related functions (module interface)
25  * \ingroup enum
26  * Module: \ref enum
27  */
28 
29 
30 #ifndef ENUM_H
31 #define ENUM_H
32 
33 
34 #include "../../core/parser/msg_parser.h"
35 
36 
37 #define MAX_DOMAIN_SIZE 256
38 #define MAX_NUM_LEN 33
39 #define MAX_COMPONENT_SIZE \
40 	(MAX_NUM_LEN * 2) /* separator, apex, ... This simplifies checks */
41 
42 
43 /*
44  * Check if from user is an e164 number and has a naptr record
45  */
46 int is_from_user_enum_0(struct sip_msg *_msg, char *_str1, char *_str2);
47 int is_from_user_enum_1(struct sip_msg *_msg, char *_suffix, char *_str2);
48 int is_from_user_enum_2(struct sip_msg *_msg, char *_suffix, char *_service);
49 
50 /*
51  * do source number destination routing.
52  * that is, make the ruri based on the from number
53  * this is like source ip policy routing
54  */
55 int enum_pv_query_1(struct sip_msg *_msg, char *_sp, char *_p2);
56 int enum_pv_query_2(struct sip_msg *_msg, char *_sp, char *_suffix);
57 int enum_pv_query_3(
58 		struct sip_msg *_msg, char *_sp, char *_suffix, char *_service);
59 
60 /*
61  * Make enum query and if query succeeds, replace current uri with the
62  * result of the query
63  */
64 int enum_query(struct sip_msg *_msg, str *suffix, str *service);
65 int enum_query_0(struct sip_msg *_msg, char *_str1, char *_str2);
66 int enum_query_1(struct sip_msg *_msg, char *_suffix, char *_str2);
67 int enum_query_2(struct sip_msg *_msg, char *_suffix, char *_service);
68 
69 /*
70  * Infrastructure ENUM versions.
71  */
72 int i_enum_query_0(struct sip_msg *_msg, char *_str1, char *_str2);
73 int i_enum_query_1(struct sip_msg *_msg, char *_suffix, char *_str2);
74 int i_enum_query_2(struct sip_msg *_msg, char *_suffix, char *_service);
75 
76 /*
77  * Exports to Kemi framework.
78  */
79 int ki_is_from_user_enum(sip_msg_t *msg);
80 int ki_is_from_user_enum_suffix(sip_msg_t *msg, str *vsuffix);
81 int ki_is_from_user_enum_suffix_service(sip_msg_t *msg, str *vsuffix,
82 		str *vservice);
83 int ki_enum_query(sip_msg_t *msg);
84 int ki_enum_query_suffix(sip_msg_t *msg, str *vsuffix);
85 int ki_enum_query_suffix_service(sip_msg_t *msg, str *vsuffix, str *vservice);
86 int ki_i_enum_query(sip_msg_t *msg);
87 int ki_i_enum_query_suffix(sip_msg_t *msg, str *vsuffix);
88 int ki_i_enum_query_suffix_service(sip_msg_t *msg, str *vsuffix, str *vservice);
89 int ki_enum_pv_query(sip_msg_t *msg, str *ve164);
90 int ki_enum_pv_query_suffix(sip_msg_t *msg, str *ve164, str *vsuffix);
91 int ki_enum_pv_query_suffix_service(sip_msg_t *msg, str *ve164, str *vsuffix,
92 		str *vservice);
93 
94 #endif /* ENUM_H */
95