"Fossies" - the Fresh Open Source Software Archive

Member "bayonne-1.2.16/admin/sitemon/sitemon.h" (1 Jan 2003, 2826 Bytes) of package /linux/misc/old/bayonne-1.2.16.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sitemon.h" see the Fossies "Dox" file reference documentation.

    1 // Copyright (C) 2000 Open Source Telecom Corporation.
    2 //  
    3 // This program is free software; you can redistribute it and/or modify
    4 // it under the terms of the GNU General Public License as published by
    5 // the Free Software Foundation; either version 2 of the License, or
    6 // (at your option) any later version.
    7 // 
    8 // This program is distributed in the hope that it will be useful,
    9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11 // GNU General Public License for more details.
   12 // 
   13 // You should have received a copy of the GNU General Public License
   14 // along with this program; if not, write to the Free Software 
   15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   16 
   17 #include <fx.h>
   18 #include <string.h>
   19 #if defined(__WIN32__) && !defined(__CYGWIN32__)
   20 #include <winsock2.h>
   21 #include <io.h>
   22 #define snprintf    _snprintf
   23 #else
   24 #include <unistd.h>
   25 #include <netinet/in.h>
   26 #include <sys/types.h>
   27 #include <sys/socket.h>
   28 #include <arpa/inet.h>
   29 #endif
   30 
   31 #define MAX_NODES   32
   32 
   33 #pragma pack(1)
   34 
   35 typedef struct {
   36         time_t  update;
   37         char name[16];
   38         struct in_addr addr;
   39     unsigned long uptime;
   40     unsigned long calls;
   41         unsigned char version;
   42         unsigned char buddies;
   43         unsigned char spansize;
   44         unsigned short ports;
   45         char stat[840];
   46 }       statnode_t;
   47 
   48 #pragma pack()
   49 
   50 class Node
   51 {
   52 private:
   53     friend class MyTable;
   54 
   55     FXHorizontalFrame *row;
   56     FXLabel *lname, *llive, *lstat, *luptime, *lcalls;
   57 
   58     statnode_t packet;
   59     struct sockaddr_in addr;
   60     unsigned short port;
   61     char live[5];
   62     char name[17];
   63     char uptime[12];
   64     char calls[12];
   65 
   66     void init(statnode_t *packet, struct sockaddr_in *addr);
   67     void status(statnode_t *packet);
   68 
   69 public:
   70     Node();
   71 };
   72 
   73 class MyTable : public FXMainWindow
   74 {
   75 private:
   76     FXDECLARE(MyTable);
   77 
   78     FXFont *fixed, *general;    
   79     FXTooltip *tooltip;
   80     FXMenubar *menubar;
   81     FXTimer *timer;
   82     FXMenuPane *filemenu, *controlmenu;
   83     int warning, expires;
   84     FXColor red, yellow, green;
   85 
   86     FXScrollWindow *contents;
   87     FXVerticalFrame *frame;
   88     FXHorizontalFrame *headers;
   89     unsigned nodes, maxnodes;
   90     Node *node;
   91 
   92 public:
   93     inline FXColor getGreen(void)
   94         {return green;};
   95 
   96     inline FXFont *getFixed(void)
   97         {return fixed;};
   98 
   99     inline FXFont *getGeneral(void)
  100         {return general;};
  101 
  102     inline FXVerticalFrame *getFrame(void)
  103         {return frame;};
  104 
  105     long onMenu(FXObject *object, FXSelector sel, void *ptr);
  106     long onTimer(FXObject *object, FXSelector sel, void *ptr);
  107     long onPacket(FXObject *object, FXSelector sel, void *ptr);
  108 
  109     enum
  110     {
  111         ID_TIMER = FXMainWindow::ID_LAST,
  112         ID_PACKET,
  113         ID_COMPILE,
  114         ID_DOWN,
  115         ID_RESTART,
  116         ID_INTERFACE,
  117         ID_QUIT     // must be last!
  118     };
  119 
  120     MyTable();
  121     ~MyTable();
  122 };
  123 
  124 void setInterface(void);
  125 
  126 extern FXApp *myapp;
  127 extern MyTable *mytable;
  128 extern int so;