Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

bayonneserver.h

Go to the documentation of this file.
00001 // Copyright (C) 2000-2001 Open Source Telecom Corporation.
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 
00017 #ifndef CCXX_BAYONNEWINDOWS_H_
00018 #include <cc++/config.h>
00019 #ifdef  WIN32
00020 #include "bayonnewindows.h"
00021 #else
00022 #include "bayonneconfig.h"
00023 #include "bayonnepaths.h"
00024 #endif
00025 #endif
00026 #include "bayonnescript.h"
00027 #include "bayonnesymbols.h"
00028 #include "bayonneaudio.h"
00029 #include "bayonne.h"
00030 
00031 #ifdef  CCXX_NAMESPACES
00032 namespace ost {
00033 #endif
00034 
00035 #ifdef  HAVE_TGI
00036 
00037 // determine size of tgi command buffer based on atomic size of fifo,
00038 // ideally using a fraction of a xk buffer.
00039 
00040 #ifdef  USE_SOCKETPAIR
00041 
00042 #define TGI_BUF (1024)
00043 
00044 #else
00045 
00046 #if PIPE_BUF > 1024
00047 #define TGI_BUF (1024)
00048 #else
00049 #define TGI_BUF (512)
00050 #endif
00051 
00052 #endif
00053 
00054 // type of tgi execution request
00055 
00056 typedef enum
00057 {
00058         TGI_EXEC_NORMAL,
00059         TGI_EXEC_DETACH,
00060         TGI_EXEC_AUDIO,
00061         TGI_EXEC_IMMEDIATE
00062 } tgiexec_t;
00063 
00064 #pragma pack(1)
00065 typedef struct
00066 {
00067         char port[16];          // tgi port reference
00068         unsigned short seq;     // sequence check id
00069         tgiexec_t mode;         // execution mode
00070         char cmd[TGI_BUF - 16 - sizeof(short) - sizeof(tgiexec_t)];
00071 } tgicmd_t;
00072 
00073 #endif
00074 
00075 typedef struct callrec_t
00076 {
00077         char cr_time[6];
00078         char cr_type[5];
00079         char cr_caller[17];
00080         char cr_dialed[17];
00081         char cr_script[13];
00082         char cr_login[12];
00083         char cr_nl;
00084 } callrec_t;
00085 
00086 typedef struct {
00087         time_t update;
00088         statnode_t *buddy;
00089 }       buddy_t;
00090 
00091 typedef struct {
00092         char grp[32];
00093         char scr[32];
00094 }       schedtmp;
00095 
00096 #pragma pack()
00097 
00098 
00099 #ifdef  NODE_SERVICES
00100 
00101 // the network service thread.
00102 
00103 class Network : public Thread, public UDPSocket, public MappedFile
00104 {
00105 private:
00106         friend void broadcast(char *msgbuf, int msglen);
00107         friend statnode_t *getNodes(const char *name);
00108 
00109         statnode_t *map;
00110         time_t last;
00111         char *getPath(void);
00112         statnode_t *getNode(const char *name);
00113         statnode_t *getAddr(struct in_addr *addr);
00114         struct sockaddr bcast, maddr;
00115         struct sockaddr_in *bcast_in, *maddr_in;
00116 
00117         void initial(void);
00118         void run(void);
00119         void failover(void);
00120         void elect(void);
00121         void send(char *msgbuf, int msglen);
00122 
00123 public:
00124         Network();
00125 
00126         void stop(void);
00127         void refresh(int secs);
00128 };
00129 
00130 #endif
00131 
00132 class __EXPORT MappedCalls : public MappedFile
00133 {
00134 private:
00135         const char *getPath(void);
00136 
00137 public:
00138         MappedCalls();
00139 };
00140 
00141 class __EXPORT MappedStats : public MappedFile
00142 {
00143 private:
00144         char *map;
00145         const char *getPath(void);
00146 
00147 public:
00148         MappedStats();
00149         void scan(void);
00150 };
00151 
00152 class __EXPORT UsageStat : public CallStat
00153 {
00154 private:
00155         friend class MappedUsage;
00156         friend class Trunk;
00157 
00158 protected:
00159         UsageStat() : CallStat() {maxcapacity = 0;};
00160 
00161         unsigned maxcapacity;
00162 
00163         void decCapacity(void);
00164 
00165         void incCapacity(void);
00166 };
00167 
00168 class __EXPORT MappedUsage : public MappedFile
00169 {
00170 private:
00171         char *map;
00172         const char *getPath(void);
00173 
00174 public:
00175         UsageStat portuse, virtuse, netuse, specuse;
00176         MappedUsage();
00177         void scan(void);
00178         void report(void);
00179 };      
00180 
00181 #ifdef  NODE_SERVICES
00182 extern Network *network;
00183 #endif
00184 #ifdef  HAVE_TGI
00185 extern int tgipipe[2];
00186 #endif
00187 //extern int mainpid;
00188 extern char df_used[4], df_free[4];
00189 extern bool restart_server;
00190 extern __EXPORT MappedUsage *usage;
00191 
00192 #ifdef CCXX_NAMESPACES
00193 }
00194 #endif

Generated on Tue Sep 13 02:19:08 2005 for Bayonne by  doxygen 1.4.4