1 /* 2 * This file is part of the Sofia-SIP package 3 * 4 * Copyright (C) 2008 Nokia Corporation. 5 * 6 * Contact: Pekka Pessi <pekka.pessi@nokia.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public License 10 * as published by the Free Software Foundation; either version 2.1 of 11 * the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 21 * 02110-1301 USA 22 */ 23 24 #ifndef CHECK_NTA_H 25 #define CHECK_NTA_H 26 27 #include <s2check.h> 28 29 #include <sofia-sip/sip.h> 30 #include <sofia-sip/tport.h> 31 #include <sofia-sip/nta.h> 32 33 #include <stdarg.h> 34 35 #include "s2sip.h" 36 37 extern struct s2nta { 38 su_home_t home[1]; 39 40 nta_agent_t *nta; 41 42 su_root_t *root; 43 44 nta_leg_t *default_leg; 45 46 struct event { 47 struct event *next, **prev; 48 49 nta_agent_magic_t *amagic; 50 51 nta_outgoing_magic_t *omagic; 52 nta_outgoing_t *orq; 53 54 nta_leg_magic_t *lmagic; 55 nta_leg_t *leg; 56 57 nta_incoming_magic_t *imagic; 58 nta_incoming_t *irq; 59 60 sip_method_t method; 61 char const *method_name; 62 63 int status; 64 char const *phrase; 65 66 msg_t *msg; 67 sip_t *sip; 68 } *events; 69 } *s2; 70 71 struct event *s2_nta_remove_event(struct event *e); 72 void s2_nta_free_event(struct event *e); 73 void s2_nta_flush_events(void); 74 struct event *s2_nta_next_event(void); 75 76 enum wait_for { 77 wait_for_amagic = 1, 78 wait_for_omagic, 79 wait_for_orq, 80 wait_for_lmagic, 81 wait_for_leg, 82 wait_for_imagic, 83 wait_for_irq, 84 wait_for_method, 85 wait_for_method_name, 86 wait_for_status, 87 wait_for_phrase 88 }; 89 90 struct event *s2_nta_vwait_for(enum wait_for, 91 void const *value, 92 va_list va); 93 94 struct event *s2_nta_wait_for(enum wait_for, 95 void const *value, 96 ...); 97 98 int s2_nta_check_for(enum wait_for, 99 void const *value, 100 ...); 101 102 int s2_nta_msg_callback(nta_agent_magic_t *magic, 103 nta_agent_t *nta, 104 msg_t *msg, 105 sip_t *sip); 106 int s2_nta_orq_callback(nta_outgoing_magic_t *magic, 107 nta_outgoing_t *orq, 108 sip_t const *sip); 109 int s2_nta_leg_callback(nta_leg_magic_t *magic, 110 nta_leg_t *leg, 111 nta_incoming_t *irq, 112 sip_t const *sip); 113 int s2_nta_irq_callback(nta_incoming_magic_t *magic, 114 nta_incoming_t *irq, 115 sip_t const *sip); 116 117 void s2_nta_setup_logs(int level); 118 void s2_nta_setup(char const *label, 119 char const * const *transports, 120 tag_type_t tag, tag_value_t value, ...); 121 122 nta_agent_t *s2_nta_agent_setup(url_string_t const *bind_url, 123 nta_message_f *callback, 124 nta_agent_magic_t *magic, 125 tag_type_t tag, tag_value_t value, ...); 126 void s2_nta_teardown(void); 127 128 TCase *check_nta_api_1_0(void); 129 TCase *check_nta_client_2_0(void); 130 TCase *check_nta_client_2_1(void); 131 TCase *check_nta_client_2_2(void); 132 133 #endif 134