encode_msg.h

00001 /* $Id$
00002  *
00003  * Copyright (C) 2006-2007 VozTelecom Sistemas S.L
00004  *
00005  * This file is part of Kamailio, a free SIP server.
00006  *
00007  * Kamailio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version
00011  *
00012  * Kamailio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License 
00018  * along with this program; if not, write to the Free Software 
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  */
00021 
00022 
00023 #include "../../parser/hf.h"
00024 #include "../../parser/msg_parser.h"
00025 
00026 #define MAX_ERROR 32
00027 #define MAX_HEADERS 32
00028 #define MAX_ENCODED_MSG 1500
00029 #define MAX_MESSAGE_LEN 1500
00030 
00031 #define TYPE_IDX 0
00032 #define MSG_START_IDX   (TYPE_IDX+2)
00033 #define MSG_LEN_IDX     (MSG_START_IDX+2)
00034 #define CONTENT_IDX     (MSG_LEN_IDX+2)
00035 #define METHOD_CODE_IDX (CONTENT_IDX+2)
00036 #define URI_REASON_IDX  (METHOD_CODE_IDX+2)
00037 #define VERSION_IDX     (URI_REASON_IDX+2)
00038 #define REQUEST_URI_IDX (VERSION_IDX+2)
00039 
00040 #define GET_PAY_SIZE( A ) (ntohs(((short*)( A ))[1]) + ntohs(((short*)( A ))[2]))
00041 char get_header_code(struct hdr_field *f);
00042 int encode_msg(struct sip_msg *msg,char *payload,int len);
00043 int print_encoded_msg(FILE* fd,char *code,char *prefix);
00044 int dump_msg_test(char *code,FILE* fd,char header,char segregationLevel);
00045 extern unsigned int theSignal;