1
/* $Id: sip_transport_loop.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJSIP_TRANSPORT_LOOP_H__
21
#define __PJSIP_TRANSPORT_LOOP_H__
25
* @file sip_transport_loop.h
27
* Loopback transport (for debugging)
31
#include <pjsip/sip_transport.h>
34
* @defgroup PJSIP_TRANSPORT_LOOP Loop Transport
35
* @ingroup PJSIP_TRANSPORT
36
* @brief Loopback transport (for testing purposes).
38
* The loopback transport simply bounce back outgoing messages as
39
* incoming messages. This feature is used mostly during automated
40
* testing, to provide controlled behavior.
46
* Create and start datagram loop transport.
48
* @param endpt The endpoint instance.
49
* @param transport Pointer to receive the transport instance.
51
* @return PJ_SUCCESS on success.
53
PJ_DECL(pj_status_t) pjsip_loop_start( pjsip_endpoint *endpt,
54
pjsip_transport **transport);
58
* Enable/disable flag to discard any packets sent using the specified
61
* @param tp The loop transport.
62
* @param discard If non-zero, any outgoing packets will be discarded.
63
* @param prev_value Optional argument to receive previous value of
66
* @return PJ_SUCCESS on success.
68
PJ_DECL(pj_status_t) pjsip_loop_set_discard( pjsip_transport *tp,
70
pj_bool_t *prev_value );
74
* Enable/disable flag to simulate network error. When this flag is set,
75
* outgoing transmission will return either immediate error or error via
76
* callback. If error is to be notified via callback, then the notification
77
* will occur after some delay, which is controlled by #pjsip_loop_set_delay().
79
* @param tp The loop transport.
80
* @param fail_flag If set to 1, the transport will return fail to deliver
81
* the message. If delay is zero, failure will occur
82
* immediately; otherwise it will be reported in callback.
83
* If set to zero, the transport will successfully deliver
85
* @param prev_value Optional argument to receive previous value of
88
* @return PJ_SUCCESS on success.
90
PJ_DECL(pj_status_t) pjsip_loop_set_failure( pjsip_transport *tp,
96
* Set delay (in miliseconds) before packet is received by the other end
97
* of the loop transport. This will also
98
* control the delay for error notification callback.
100
* @param tp The loop transport.
101
* @param delay Delay, in miliseconds.
102
* @param prev_value Optional argument to receive previous value of the
105
* @return PJ_SUCCESS on success.
107
PJ_DECL(pj_status_t) pjsip_loop_set_recv_delay( pjsip_transport *tp,
109
unsigned *prev_value);
113
* Set delay (in miliseconds) before send notification is delivered to sender.
114
* This will also control the delay for error notification callback.
116
* @param tp The loop transport.
117
* @param delay Delay, in miliseconds.
118
* @param prev_value Optional argument to receive previous value of the
121
* @return PJ_SUCCESS on success.
123
PJ_DECL(pj_status_t) pjsip_loop_set_send_callback_delay( pjsip_transport *tp,
125
unsigned *prev_value);
129
* Set both receive and send notification delay.
131
* @param tp The loop transport.
132
* @param delay Delay, in miliseconds.
134
* @return PJ_SUCCESS on success.
136
PJ_DECL(pj_status_t) pjsip_loop_set_delay( pjsip_transport *tp,
146
#endif /* __PJSIP_TRANSPORT_LOOP_H__ */