cr_fifo.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2007-2008 1&1 Internet AG
00005  *
00006  * This file is part of SIP-router, a free SIP server.
00007  *
00008  * SIP-router 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  * SIP-router 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 CR_FIFO_H
00031 #define CR_FIFO_H
00032 
00033 #include "../../lib/kmi/mi.h"
00034 
00035 extern int fifo_err;
00036 
00037 #define E_MISC -1
00038 #define E_NOOPT -2
00039 #define E_WRONGOPT -3
00040 #define E_NOMEM -4
00041 #define E_RESET -5
00042 #define E_NOAUTOBACKUP -6
00043 #define E_NOHASHBACKUP -7
00044 #define E_NOHOSTBACKUP -8
00045 #define E_ADDBACKUP -9
00046 #define E_DELBACKUP -10
00047 #define E_LOADCONF -11
00048 #define E_SAVECONF -12
00049 #define E_INVALIDOPT -13
00050 #define E_MISSOPT -14
00051 #define E_RULEFIXUP -15
00052 #define E_NOUPDATE -16
00053 #define E_HELP -17
00054 
00055 #define FIFO_ERR(e) (fifo_err = e)
00056 
00061 typedef struct fifo_opt {
00062         unsigned int cmd; 
00063         unsigned int opts; 
00064         str domain; 
00065         str prefix; 
00066         double prob; 
00067         str host; 
00068         int strip; 
00069         str new_host; 
00070         str rewrite_prefix; 
00071         str rewrite_suffix; 
00072         int hash_index; 
00073         int status; 
00074 }
00075 fifo_opt_t;
00076 
00077 #define FBUF_SIZE 2048
00078 
00079 #define OPT_ADD 0
00080 #define OPT_REMOVE 1
00081 #define OPT_REPLACE 2
00082 #define OPT_DEACTIVATE 3
00083 #define OPT_ACTIVATE 4
00084 
00085 #define OPT_MANDATORY 0
00086 #define OPT_OPTIONAL 1
00087 #define OPT_INVALID 2
00088 
00089 #define OPT_PREFIX 0
00090 #define OPT_DOMAIN 1
00091 #define OPT_HOST 2
00092 #define OPT_NEW_TARGET 3
00093 #define OPT_PROB 4
00094 #define OPT_R_PREFIX 5
00095 #define OPT_R_SUFFIX 6
00096 #define OPT_HASH_INDEX 7
00097 #define OPT_STRIP 8
00098 
00102 #define O_PREFIX           1
00103 #define O_DOMAIN     (1 << 1)
00104 #define O_HOST       (1 << 2)
00105 #define O_NEW_TARGET (1 << 3)
00106 #define O_PROB       (1 << 4)
00107 #define O_R_PREFIX   (1 << 5)
00108 #define O_R_SUFFIX   (1 << 6)
00109 #define O_H_INDEX    (1 << 7)
00110 #define O_STRIP      (1 << 8)
00111 
00115 #define OPT_PREFIX_CHR 'p'
00116 #define OPT_DOMAIN_CHR 'd'
00117 #define OPT_HOST_CHR 'h'
00118 #define OPT_NEW_TARGET_CHR 't'
00119 #define OPT_PROB_CHR 'w'
00120 #define OPT_R_PREFIX_CHR 'P'
00121 #define OPT_R_SUFFIX_CHR 'S'
00122 #define OPT_HASH_INDEX_CHR 'i'
00123 #define OPT_STRIP_CHR 's'
00124 #define OPT_HELP_CHR '?'
00125 
00126 #define OPT_STAR "*"
00127 
00128 struct mi_root* reload_fifo (struct mi_root* cmd_tree, void *param);
00129 
00130 struct mi_root* dump_fifo (struct mi_root* cmd_tree, void *param);
00131 
00132 struct mi_root* replace_host (struct mi_root* cmd_tree, void *param);
00133 
00134 struct mi_root* deactivate_host (struct mi_root* cmd_tree, void *param);
00135 
00136 struct mi_root* activate_host (struct mi_root* cmd_tree, void *param);
00137 
00138 struct mi_root* add_host (struct mi_root* cmd_tree, void *param);
00139 
00140 struct mi_root* delete_host (struct mi_root* cmd_tree, void * param);
00141 
00142 #endif