dialog.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2010, Digium, Inc.
00005  *
00006  * See http://www.asterisk.org for more information about
00007  * the Asterisk project. Please do not directly contact
00008  * any of the maintainers of this project for assistance;
00009  * the project provides a web site, mailing lists and IRC
00010  * channels for your use.
00011  *
00012  * This program is free software, distributed under the terms of
00013  * the GNU General Public License Version 2. See the LICENSE file
00014  * at the top of the source tree.
00015  */
00016 
00017 /*!
00018  * \file
00019  * \brief sip dialog management header file
00020  */
00021 
00022 #include "sip.h"
00023 
00024 #ifndef _SIP_DIALOG_H
00025 #define _SIP_DIALOG_H
00026 
00027 /*! \brief
00028  * when we create or delete references, make sure to use these
00029  * functions so we keep track of the refcounts.
00030  * To simplify the code, we allow a NULL to be passed to dialog_unref().
00031  */
00032 #define dialog_ref(dialog, tag) ao2_t_bump(dialog, tag)
00033 #define dialog_unref(dialog, tag) ({ ao2_t_cleanup(dialog, tag); (NULL); })
00034 
00035 struct sip_pvt *__sip_alloc(ast_string_field callid, struct ast_sockaddr *sin,
00036              int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid,
00037              const char *file, int line, const char *func);
00038 
00039 #define sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid) \
00040    __sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid, __FILE__, __LINE__, __PRETTY_FUNCTION__)
00041 
00042 void sip_scheddestroy_final(struct sip_pvt *p, int ms);
00043 void sip_scheddestroy(struct sip_pvt *p, int ms);
00044 int sip_cancel_destroy(struct sip_pvt *p);
00045 
00046 /*! \brief Destroy SIP call structure.
00047  * Make it return NULL so the caller can do things like
00048  * foo = sip_destroy(foo);
00049  * and reduce the chance of bugs due to dangling pointers.
00050  */
00051 struct sip_pvt *sip_destroy(struct sip_pvt *p);
00052 
00053 /*! \brief Destroy SIP call structure.
00054  * Make it return NULL so the caller can do things like
00055  * foo = sip_destroy(foo);
00056  * and reduce the chance of bugs due to dangling pointers.
00057  */
00058 void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist);
00059 /*!
00060  * \brief Unlink a dialog from the dialogs container, as well as any other places
00061  * that it may be currently stored.
00062  *
00063  * \note A reference to the dialog must be held before calling
00064  * this function, and this function does not release that
00065  * reference.
00066  *
00067  * \note The dialog must not be locked when called.
00068  */
00069 void dialog_unlink_all(struct sip_pvt *dialog);
00070 
00071 /*! \brief Acknowledges receipt of a packet and stops retransmission
00072  * called with p locked*/
00073 int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod);
00074 
00075 /*! \brief Pretend to ack all packets
00076  * called with p locked */
00077 void __sip_pretend_ack(struct sip_pvt *p);
00078 
00079 /*! \brief Acks receipt of packet, keep it around (used for provisional responses) */
00080 int __sip_semi_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod);
00081 
00082 #endif /* defined(_SIP_DIALOG_H) */

Generated on Thu Apr 16 06:27:33 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6