nta 1.12.11devel
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2008 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 */ 00023 00024 #ifndef CHECK_NTA_H 00025 #define CHECK_NTA_H 00026 00027 #include <s2check.h> 00028 00029 #include <sofia-sip/sip.h> 00030 #include <sofia-sip/tport.h> 00031 #include <sofia-sip/nta.h> 00032 00033 #include <stdarg.h> 00034 00035 #include "s2sip.h" 00036 00037 extern struct s2nta { 00038 su_home_t home[1]; 00039 00040 nta_agent_t *nta; 00041 00042 su_root_t *root; 00043 00044 nta_leg_t *default_leg; 00045 00046 struct event { 00047 struct event *next, **prev; 00048 00049 nta_agent_magic_t *amagic; 00050 00051 nta_outgoing_magic_t *omagic; 00052 nta_outgoing_t *orq; 00053 00054 nta_leg_magic_t *lmagic; 00055 nta_leg_t *leg; 00056 00057 nta_incoming_magic_t *imagic; 00058 nta_incoming_t *irq; 00059 00060 sip_method_t method; 00061 char const *method_name; 00062 00063 int status; 00064 char const *phrase; 00065 00066 msg_t *msg; 00067 sip_t *sip; 00068 } *events; 00069 } *s2; 00070 00071 struct event *s2_nta_remove_event(struct event *e); 00072 void s2_nta_free_event(struct event *e); 00073 void s2_nta_flush_events(void); 00074 struct event *s2_nta_next_event(void); 00075 00076 enum wait_for { 00077 wait_for_amagic = 1, 00078 wait_for_omagic, 00079 wait_for_orq, 00080 wait_for_lmagic, 00081 wait_for_leg, 00082 wait_for_imagic, 00083 wait_for_irq, 00084 wait_for_method, 00085 wait_for_method_name, 00086 wait_for_status, 00087 wait_for_phrase 00088 }; 00089 00090 struct event *s2_nta_vwait_for(enum wait_for, 00091 void const *value, 00092 va_list va); 00093 00094 struct event *s2_nta_wait_for(enum wait_for, 00095 void const *value, 00096 ...); 00097 00098 int s2_nta_check_for(enum wait_for, 00099 void const *value, 00100 ...); 00101 00102 int s2_nta_msg_callback(nta_agent_magic_t *magic, 00103 nta_agent_t *nta, 00104 msg_t *msg, 00105 sip_t *sip); 00106 int s2_nta_orq_callback(nta_outgoing_magic_t *magic, 00107 nta_outgoing_t *orq, 00108 sip_t const *sip); 00109 int s2_nta_leg_callback(nta_leg_magic_t *magic, 00110 nta_leg_t *leg, 00111 nta_incoming_t *irq, 00112 sip_t const *sip); 00113 int s2_nta_irq_callback(nta_incoming_magic_t *magic, 00114 nta_incoming_t *irq, 00115 sip_t const *sip); 00116 00117 void s2_nta_setup_logs(int level); 00118 void s2_nta_setup(char const *label, 00119 char const * const *transports, 00120 tag_type_t tag, tag_value_t value, ...); 00121 00122 nta_agent_t *s2_nta_agent_setup(url_string_t const *bind_url, 00123 nta_message_f *callback, 00124 nta_agent_magic_t *magic, 00125 tag_type_t tag, tag_value_t value, ...); 00126 void s2_nta_teardown(void); 00127 00128 TCase *check_nta_api_1_0(void); 00129 00130 TCase *check_nta_client_2_0(void); 00131 TCase *check_nta_client_2_1(void); 00132 TCase *check_nta_client_2_2(void); 00133 00134 TCase *check_nta_server_3_0(void); 00135 00136 #endif