parse_fline.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00034 #ifndef PARSE_FLINE_H
00035 #define PARSE_FLINE_H
00036 
00037 #include "../str.h"
00038 
00039 /* Message is request */
00040 #define SIP_REQUEST 1
00041 
00042 /* Message is reply */
00043 #define SIP_REPLY   2
00044 
00045 /* Invalid message */
00046 #define SIP_INVALID 0
00047 
00048 #define SIP_VERSION "SIP/2.0"
00049 #define SIP_VERSION_LEN 7
00050 
00051 #define HTTP_VERSION "HTTP/1."
00052 #define HTTP_VERSION_LEN (sizeof(HTTP_VERSION)-1)
00053 
00054 #define CANCEL "CANCEL"
00055 #define ACK    "ACK"
00056 #define INVITE "INVITE"
00057 
00058 #define INVITE_LEN 6
00059 #define CANCEL_LEN 6
00060 #define ACK_LEN 3
00061 #define BYE_LEN 3
00062 #define INFO_LEN 4
00063 #define REGISTER_LEN 8
00064 #define SUBSCRIBE_LEN 9
00065 #define NOTIFY_LEN 6
00066 #define MESSAGE_LEN 7
00067 #define OPTIONS_LEN 7
00068 #define PRACK_LEN 5
00069 #define UPDATE_LEN 6
00070 #define REFER_LEN 5
00071 #define PUBLISH_LEN 7
00072 
00073 struct msg_start {
00074         int type;                                       
00075         int len;                                        
00076         union {
00077                 struct {
00078                         str method;       
00079                         str uri;          
00080                         str version;      
00081                         int method_value;
00082                 } request;
00083                 struct {
00084                         str version;      
00085                         str status;       
00086                         str reason;       
00087                         unsigned int  statuscode;
00088                 } reply;
00089         }u;
00090 };
00091 
00092 
00093 
00094 char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl);
00095 
00096 char* parse_fline(char* buffer, char* end, struct msg_start* fl);
00097 
00098 
00099 #endif /* PARSE_FLINE_H */