Debian Codegraph @

src/modules/lost/response.h

raw symbols SCIP
1 /*
2 * lost module LoST response parsing functions
3 *
4 * Copyright (C) 2022 Wolfgang Kampichler
5 * DEC112, FREQUENTIS AG
6 *
7 * This file is part of Kamailio, a free SIP server.
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 *
11 * Kamailio is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version
15 *
16 * Kamailio is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 *
25 */
26
27 /*!
28 * \file
29 * \brief Kamailio lost :: response
30 * \ingroup lost
31 * Module: \ref lost
32 */
33
34 #ifndef LOST_RESPONSE_H
35 #define LOST_RESPONSE_H
36
37 #define PROP_LANG (const char *)"lang"
38 #define PROP_MSG (const char *)"message"
39
40 #define ROOT_NODE (const char *)"findServiceResponse"
41 #define DISPNAME_NODE (const char *)"displayName"
42 #define SERVICE_NODE (const char *)"service"
43 #define SERVICENR_NODE (const char *)"serviceNumber"
44 #define WARNINGS_NODE (const char *)"warnings"
45 #define PATH_NODE (const char *)"via"
46 #define PATH_NODE_VIA (const char *)"via"
47 #define MAPP_NODE (const char *)"mapping"
48 #define MAPP_NODE_URI (const char *)"uri"
49 #define MAPP_PROP_EXP (const char *)"expires"
50 #define MAPP_PROP_LUP (const char *)"lastUpdated"
51 #define MAPP_PROP_SRC (const char *)"source"
52 #define MAPP_PROP_SID (const char *)"sourceId"
53
54 #define RED_NODE (const char *)"redirect"
55 #define RED_PROP_TAR (const char *)"target"
56 #define RED_PROP_SRC (const char *)"source"
57 #define RED_PROP_MSG (const char *)"message"
58
59 #define ERRORS_NODE (const char *)"errors"
60
61 #define SIP_S (const char *)"sip:"
62 #define SIPS_S (const char *)"sips:"
63
64 #define HELD_RESPONSE_REFERENCE 1
65 #define HELD_RESPONSE_VALUE 2
66
67 typedef struct lost_list
68 {
69 char *value;
70 struct lost_list *next;
71 } s_lost_list_t, *p_lost_list_t;
72
73 typedef struct lost_info
74 {
75 char *text;
76 char *lang;
77 } s_lost_info_t, *p_lost_info_t;
78
79 typedef struct lost_data
80 {
81 char *expires;
82 char *updated;
83 char *source;
84 char *sourceid;
85 char *urn;
86 char *number;
87 p_lost_info_t name;
88 } s_lost_data_t, *p_lost_data_t;
89
90 typedef struct lost_type
91 {
92 char *type;
93 char *target;
94 char *source;
95 p_lost_info_t info;
96 } s_lost_type_t, *p_lost_type_t;
97
98 typedef struct lost_issue
99 {
100 p_lost_type_t issue;
101 struct lost_issue *next;
102 } s_lost_issue_t, *p_lost_issue_t;
103
104 typedef enum lost_cat
105 {
106 RESPONSE,
107 ERROR,
108 REDIRECT,
109 OTHER = -1
110 } lost_cat_t;
111
112 typedef struct lost_fsr
113 {
114 lost_cat_t category;
115 p_lost_data_t mapping;
116 p_lost_issue_t warnings;
117 p_lost_issue_t errors;
118 p_lost_type_t redirect;
119 p_lost_list_t path;
120 p_lost_list_t uri;
121 } s_lost_fsr_t, *p_lost_fsr_t;
122
123 /* read and parse response data */
124 p_lost_fsr_t lost_parse_findServiceResponse(str);
125 /* check response to dereference request */
126 int lost_check_HeldResponse(xmlNodePtr);
127 /* appends value to list objects */
128 int lost_append_response_list(p_lost_list_t *, str);
129 /* print the response */
130 void lost_print_findServiceResponse(p_lost_fsr_t);
131 /* remove response data from memory */
132 void lost_free_findServiceResponse(p_lost_fsr_t *);
133
134 /* uri scheme parsing */
135 int is_urn(char *);
136 int is_cid(char *);
137 int is_http(char *);
138 int is_https(char *);
139 int is_cid_laquot(char *);
140 int is_http_laquot(char *);
141 int is_https_laquot(char *);
142
143 /* list search */
144 int lost_search_response_list(p_lost_list_t *, char **, const char *);
145
146 #endif