t_msgbuilder.h

00001 /*
00002  * $Id$
00003  *
00004  *
00005  * Copyright (C) 2001-2003 FhG Fokus
00006  *
00007  * This file is part of ser, a free SIP server.
00008  *
00009  * ser is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * For a license to use the ser software under conditions
00015  * other than those described here, or to purchase support for this
00016  * software, please contact iptel.org by e-mail at the following addresses:
00017  *    info@iptel.org
00018  *
00019  * ser is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU General Public License 
00025  * along with this program; if not, write to the Free Software 
00026  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  *
00028  * History:
00029  * --------
00030  *  2004-02-11  FIFO/CANCEL + alignments (hash=f(callid,cseq)) (uli+jiri)
00031  */
00032 
00033 
00034 #ifndef _MSGBUILDER_H
00035 #define _MSGBUILDER_H
00036 
00037 #include "../../ip_addr.h"
00038 #include "defs.h"
00039 #include "dlg.h"
00040 #include "h_table.h"
00041 
00042 
00043 #define CSEQ "CSeq: "
00044 #define CSEQ_LEN (sizeof(CSEQ)-1)
00045 #define TO "To: "
00046 #define TO_LEN (sizeof(TO)-1)
00047 #define CALLID "Call-ID: "
00048 #define CALLID_LEN (sizeof(CALLID)-1)
00049 #define FROM "From: "
00050 #define FROM_LEN (sizeof(FROM)-1)
00051 #define FROMTAG ";tag="
00052 #define FROMTAG_LEN (sizeof(FROMTAG)-1)
00053 #define TOTAG ";tag="
00054 #define TOTAG_LEN (sizeof(TOTAG)-1)
00055 
00056 
00057 char *build_local(struct cell *Trans, unsigned int branch,
00058         unsigned int *len, char *method, int method_len, str *to
00059 #ifdef CANCEL_REASON_SUPPORT
00060         , struct cancel_reason* reason
00061 #endif /* CANCEL_REASON_SUPPORT */
00062         );
00063 
00064 char *build_local_reparse(struct cell *Trans, unsigned int branch,
00065         unsigned int *len, char *method, int method_len, str *to
00066 #ifdef CANCEL_REASON_SUPPORT
00067         , struct cancel_reason* reason
00068 #endif /* CANCEL_REASON_SUPPORT */
00069         );
00070 
00071 char *build_uac_request(  str msg_type, str dst, str from,
00072         str fromtag, int cseq, str callid, str headers, 
00073         str body, int branch,
00074         struct cell *t, unsigned int *len);
00075 
00076 /*
00077  * The function creates an UAC CANCEL
00078  */
00079 char *build_uac_cancel(str *headers,str *body,struct cell *cancelledT,
00080                 unsigned int branch, unsigned int *len, struct dest_info* dst);
00081 
00082 /*
00083  * The function creates an ACK to 200 OK. Route set will be created
00084  * and parsed and the dst parameter will contain the destination to which the
00085  * request should be send. The function is used by tm when it generates
00086  * local ACK to 200 OK (on behalf of applications using uac
00087  */
00088 char *build_dlg_ack(struct sip_msg* rpl, struct cell *Trans, 
00089                                         unsigned int branch, str *hdrs, str *body,
00090                                         unsigned int *len, struct dest_info* dst);
00091 
00092 
00093 /*
00094  * Create a request
00095  */
00096 char* build_uac_req(str* method, str* headers, str* body, dlg_t* dialog, int branch, 
00097                     struct cell *t, int* len, struct dest_info* dst);
00098 
00099 
00100 int t_calc_branch(struct cell *t,
00101         int b, char *branch, int *branch_len);
00102 
00103 /* exported minimum functions for use in t_cancel */
00104 char* print_callid_mini(char* target, str callid);
00105 char* print_cseq_mini(char* target, str* cseq, str* method);
00106 
00107 #endif