1 /*
2  * $Id$
3  *
4  * Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com
5  * Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com
6  *
7  * The initial version of this code was written by Dragos Vingarzan
8  * (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the
9  * Fruanhofer Institute. It was and still is maintained in a separate
10  * branch of the original SER. We are therefore migrating it to
11  * Kamailio/SR and look forward to maintaining it from here on out.
12  * 2011/2012 Smile Communications, Pty. Ltd.
13  * ported/maintained/improved by
14  * Jason Penton (jason(dot)penton(at)smilecoms.com and
15  * Richard Good (richard(dot)good(at)smilecoms.com) as part of an
16  * effort to add full IMS support to Kamailio/SR using a new and
17  * improved architecture
18  *
19  * NB: Alot of this code was originally part of OpenIMSCore,
20  * FhG Fokus.
21  * Copyright (C) 2004-2006 FhG Fokus
22  * Thanks for great work! This is an effort to
23  * break apart the various CSCF functions into logically separate
24  * components. We hope this will drive wider use. We also feel
25  * that in this way the architecture is more complete and thereby easier
26  * to manage in the Kamailio/SR environment
27  *
28  * This file is part of Kamailio, a free SIP server.
29  *
30  * Kamailio is free software; you can redistribute it and/or modify
31  * it under the terms of the GNU General Public License as published by
32  * the Free Software Foundation; either version 2 of the License, or
33  * (at your option) any later version
34  *
35  * Kamailio is distributed in the hope that it will be useful,
36  * but WITHOUT ANY WARRANTY; without even the implied warranty of
37  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
38  * GNU General Public License for more details.
39  *
40  * You should have received a copy of the GNU General Public License
41  * along with this program; if not, write to the Free Software
42  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
43  *
44  *
45  * History:
46  * --------
47  *  2011-02-02  initial version (jason.penton)
48  */
49 
50 #ifndef RX_AUTH_DATA_H
51 #define RX_AUTH_DATA_H
52 
53 extern struct tm_binds tmb;
54 extern struct cdp_binds cdpb;
55 extern ims_dlg_api_t dlgb;
56 
57 enum dialog_direction {
58     DLG_MOBILE_ORIGINATING = 1,
59     DLG_MOBILE_TERMINATING = 2,
60     DLG_MOBILE_REGISTER = 3,
61     DLG_MOBILE_UNKNOWN = 4
62 };
63 
64 typedef struct flow_description {
65     int stream_num;
66     str media;
67     str req_sdp_ip_addr;
68     str req_sdp_port;
69     str rpl_sdp_ip_addr;
70     str rpl_sdp_port;
71     str rpl_sdp_transport;
72     str req_sdp_raw_stream;
73     str rpl_sdp_raw_stream;
74     int direction;
75     struct flow_description *next;
76 }flow_description_t;
77 
78 typedef struct rx_authsessiondata {
79     str callid;
80     str ftag;
81     str ttag;
82     str identifier;
83     int identifier_type;
84     str via_host;       /* UE host as fetched from Via (first for REQUEST, last for REPLY) */
85     unsigned short via_port; /* UE port as fetched from Via (first for REQUEST, last for REPLY) */
86     unsigned short via_proto; /* UE proto as fetched from Via (first for REQUEST, last for REPLY) */
87     str ip;
88     int ip_version;
89     int recv_port;
90     unsigned short recv_proto;
91     //for registration session
92     int subscribed_to_signaling_path_status; // 0 not subscribed 1 is subscribed
93     int session_has_been_opened; // 0 has not been opened 1 has been opened
94     str domain;				//the domain the registration aor belongs to (for registration)
95     str registration_aor; //the aor if this rx session is a subscription to signalling status
96     int must_terminate_dialog; //0 means when this session terminates it must not terminate the relevant dialog, 1 means it must terminate the dialog
97     flow_description_t *first_current_flow_description;
98     flow_description_t *first_new_flow_description;
99 } rx_authsessiondata_t;
100 
101 int create_new_regsessiondata(str* domain, str* aor,  str *ip, int ip_version, int recv_port, unsigned short recv_proto, str *via_host, unsigned short via_port, unsigned short via_proto, rx_authsessiondata_t** session_data);
102 int create_new_callsessiondata(str* callid, str* ftag, str* ttag, str* identifier, int identifier_type, str *ip, int ip_version, rx_authsessiondata_t** session_data);
103 void free_callsessiondata(rx_authsessiondata_t* session_data);
104 
105 int add_flow_description(rx_authsessiondata_t* session_data, int stream_num, str *media, str *req_sdp_ip_addr, str *req_sdp_port,
106 			str *rpl_sdp_ip_addr, str *rpl_sdp_port, str *rpl_sdp_transport, str *req_sdp_raw_stream, str *rpl_sdp_raw_stream, int direction, int current);
107 void free_flow_description(rx_authsessiondata_t* session_data, int current);
108 
109 void show_callsessiondata(rx_authsessiondata_t* session_data);
110 
111 #endif
112 
113