blob: 98e89f96dbed0cbb7a7c29cbcf2ceceaa82d078a [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/*********************************************************************************************************
2* Software License Agreement (BSD License) *
3* Author: Alexandre Westfahl <awestfahl@freediameter.net> *
4* *
5* Copyright (c) 2010, Alexandre Westfahl, Teraoka Laboratory (Keio University), and the WIDE Project. *
6* *
7* All rights reserved. *
8* *
9* Redistribution and use of this software in source and binary forms, with or without modification, are *
10* permitted provided that the following conditions are met: *
11* *
12* * Redistributions of source code must retain the above *
13* copyright notice, this list of conditions and the *
14* following disclaimer. *
15* *
16* * Redistributions in binary form must reproduce the above *
17* copyright notice, this list of conditions and the *
18* following disclaimer in the documentation and/or other *
19* materials provided with the distribution. *
20* *
21* * Neither the name of the Teraoka Laboratory nor the *
22* names of its contributors may be used to endorse or *
23* promote products derived from this software without *
24* specific prior written permission of Teraoka Laboratory *
25* *
26* *
27* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
28* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
29* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
30* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
31* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
32* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
33* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
34* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
35*********************************************************************************************************/
36#include "test_sip.h"
37
38//Called to send a LIR
39int test_sip_LIR_cb()
40{
41 struct dict_object * lir_model=NULL;
42 struct msg * message=NULL;
43 struct avp *avp=NULL;
44 union avp_value value;
45
46 //Fake values START
47 char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
48 size_t aor_len=strlen(sip_aor);
49 char *destination_realm="tera.ics.keio.ac.jp";
50 size_t destination_realmlen=strlen(destination_realm);
51 char *destination_host="suika.tera.ics.keio.ac.jp";
52 size_t destination_hostlen=strlen(destination_host);
53 //Fake values STOP
54
55 //Create the base message for an RTR
56 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Location-Info-Request", &lir_model, ENOENT) );
57 CHECK_FCT( fd_msg_new (lir_model, 0, &message));
58
59
60
61 // Create a new session
62 {
63 CHECK_FCT( fd_msg_new_session( message, (os0_t)"appsip", CONSTSTRLEN("appsip") ) );
64 }
65
66 //Add the Auth-Application-Id
67 {
68 CHECK_FCT( fd_msg_avp_new ( sip_dict.Auth_Application_Id, 0, &avp ) );
69 value.i32 = 6;
70 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
71 CHECK_FCT( fd_msg_avp_add ( message, MSG_BRW_LAST_CHILD, avp) );
72 }
73
74 //Auth_Session_State
75 {
76 CHECK_FCT( fd_msg_avp_new ( sip_dict.Auth_Session_State, 0, &avp ) );
77 value.i32=1;
78 CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
79 CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
80 }
81
82 //Origin_Host & Origin_Realm
83 CHECK_FCT( fd_msg_add_origin ( message, 0 ));
84
85 //Destination_Host
86 {
87 CHECK_FCT( fd_msg_avp_new ( sip_dict.Destination_Host, 0, &avp ) );
88 value.os.data=(unsigned char *)destination_host;
89 value.os.len=destination_hostlen;
90 CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
91 CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
92 }
93 //Destination_Realm
94 {
95 CHECK_FCT( fd_msg_avp_new ( sip_dict.Destination_Realm, 0, &avp ) );
96 value.os.data=(unsigned char *)destination_realm;
97 value.os.len=destination_realmlen;
98 CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
99 CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
100 }
101
102 //SIP_AOR
103 {
104
105 CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_AOR, 0, &avp ) );
106 value.os.data=(unsigned char *)sip_aor;
107 value.os.len=aor_len;
108 CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
109 CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
110
111 }
112
113 CHECK_FCT( fd_msg_send( &message, NULL, NULL ));
114
115 return 0;
116}
117
118int test_sip_LIA_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act)
119{
120
121 return 0;
122}