• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

dset.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2004 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  * ser is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 
00030 #ifndef _DSET_H
00031 #define _DSET_H
00032 
00033 #include "ip_addr.h"
00034 #include "qvalue.h"
00035 #include "flags.h"
00036 #include "parser/msg_parser.h"
00037 
00038 
00039 extern unsigned int nr_branches;
00040 extern int ruri_is_new;
00041 
00045 struct branch
00046 {
00047     char uri[MAX_URI_SIZE];
00048     unsigned int len;
00049 
00050          /* Real destination of the request */
00051     char dst_uri[MAX_URI_SIZE];
00052     unsigned int dst_uri_len;
00053 
00054     /* Path set */
00055     char path[MAX_PATH_SIZE];
00056     unsigned int path_len;
00057 
00058     int q; /* Preference of the contact among
00059         * contact within the array */
00060     struct socket_info* force_send_socket;
00061 
00062     /* Branch flags */
00063     flag_t flags;
00064 };
00065 
00066 typedef struct branch branch_t;
00067 
00071 branch_t *get_sip_branch(int idx);
00072 
00076 int drop_sip_branch(int idx);
00077 
00081 int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
00082                                          qvalue_t q, unsigned int flags,
00083                                          struct socket_info* force_socket);
00084 
00086 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
00087         append_branch(msg, uri, dst_uri, path, q, flags, force_socket)
00088 
00093 static inline int ser_append_branch(struct sip_msg* msg,
00094                                                                         char* uri, int uri_len,
00095                                                                         char* dst_uri, int dst_uri_len,
00096                                                                         qvalue_t q,
00097                                                                         struct socket_info* force_socket)
00098 {
00099         str s_uri, s_dst_uri;
00100         s_uri.s=uri;
00101         s_uri.len=uri_len;
00102         s_dst_uri.s=dst_uri;
00103         s_dst_uri.len=dst_uri_len;
00104         return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket);
00105 }
00106 
00107 
00108 
00112 void init_branch_iterator(void);
00113 
00117 int get_branch_iterator(void);
00118 
00122 void set_branch_iterator(int n);
00123 
00128 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
00129                                         unsigned int* flags, struct socket_info** force_socket);
00130 
00131 
00132 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
00133                                   str* path, unsigned int *flags,
00134                                   struct socket_info** force_socket);
00135 
00136 
00137 
00141 void clear_branches(void);
00142 
00143 
00148 char* print_dset(struct sip_msg* msg, int* len);
00149 
00150 
00154 void set_ruri_q(qvalue_t q);
00155 
00156 
00160 qvalue_t get_ruri_q(void);
00161 
00162 
00163 
00164 /*
00165  * Get actual Request-URI
00166  */
00167 inline static int get_request_uri(struct sip_msg* _m, str* _u)
00168 {
00169         *_u=*GET_RURI(_m);
00170         return 0;
00171 }
00172 
00173 
00174 #define ruri_mark_new() (ruri_is_new = 1)
00175 
00176 #define ruri_mark_consumed()  (ruri_is_new = 0)
00177 
00182 #define ruri_get_forking_state() (ruri_is_new)
00183 
00184 int rewrite_uri(struct sip_msg* _m, str* _s);
00185 
00194 int setbflag(unsigned int branch, flag_t flag);
00195 
00204 int resetbflag(unsigned int branch, flag_t flag);
00205 
00214 int isbflagset(unsigned int branch, flag_t flag);
00215 
00225 int getbflagsval(unsigned int branch, flag_t* res);
00226 
00236 int setbflagsval(unsigned int branch, flag_t val);
00237 
00238 #endif /* _DSET_H */

Generated on Tue May 22 2012 13:10:06 for SIP Router by  doxygen 1.7.1