Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

wire.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2002-2005 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 
00022 #ifndef AW_WIRE
00023 #define AW_WIRE
00024 
00026 /*\@{*/
00027 
00257 #include "monitor.h"
00258 
00262 typedef enum {
00263 
00264   AW_WIRE_LIST_OBJ,          
00265   AW_WIRE_INUMBER_OBJ,       
00266   AW_WIRE_FNUMBER_OBJ,       
00267   AW_WIRE_STRING_OBJ,        
00268   AW_WIRE_EVENT_OBJ,         
00269   AW_WIRE_PLOGGER_OBJ,       
00270   AW_WIRE_HLOGGER_OBJ,       
00271   AW_WIRE_PROBE_OBJ,         
00272   AW_WIRE_HANDLER_OBJ,       
00274 } aw_wire_obj_cd_t;
00275 
00279 typedef struct aw_wire_obj_s {
00280 
00281   struct aw_wire_obj_s 
00282    *next;
00283 
00284   aw_wire_obj_cd_t
00285    type;
00286 
00287   union {
00288 
00289     void *ptr; /* generic way to reference obj */
00290 
00291     struct aw_wire_listobj_s *list;
00292 
00293     const int64_t *inumber;
00294 
00295     const float64_t *fnumber;
00296 
00297     const byte_t *string;
00298 
00299     const aw_event_sig_t *event;
00300 
00301     aw_logger_t *hlogger;
00302 
00303     aw_handler_t *handler;
00304 
00305   } obj;
00306 
00307   void (*destroy)(void *obj); /* called to free up the ptr */
00308 
00309 } aw_wire_obj_t;
00310 
00314 typedef struct aw_wire_listobj_s {
00315 
00316   struct aw_wire_listobj_s 
00317    *next;
00318 
00319   aw_wire_obj_t
00320    *objref;
00321 
00322 } aw_wire_listobj_t;
00323 
00324 
00328 typedef struct aw_wire_value_s {
00329 
00330   struct aw_wire_value_s 
00331    *next;
00332 
00333   u_int32_t
00334    isobj;                  /* non-zero if value is one of the object ptrs, we DO NOT free these! */
00335 
00336   aw_wire_obj_t
00337    value;
00338 
00339 } aw_wire_value_t;
00340 
00344 typedef struct aw_wire_keyword_s {
00345   
00346   struct aw_wire_keyword_s
00347    *next;
00348 
00349   byte_t
00350    *keyword;
00351 
00352   aw_wire_value_t
00353    *values;
00354 
00355 } aw_wire_keyword_t ;
00356 
00357 
00361 typedef struct {
00362 
00363   aw_monitor_t *mon;
00364 
00365   aw_wire_obj_t *active_wire_objs;
00366 
00367 } aw_wire_monitor_t;
00368 
00369 
00373 typedef struct {
00374 
00375   aw_monitor_t *mon;
00376 
00377   aw_wire_keyword_t *kwlist;
00378 
00379   aw_alarm_sched_t *sched;
00380 
00381   int32_t (*regevent)(aw_handler_t *, aw_address_t *, u_int32_t);
00382 
00383   const byte_t *desc;
00384 
00385   aw_logger_t *elogger; 
00386 
00387   FILE *message_stream;
00388 
00389 } aw_wire_mkhandler_args_t;
00390 
00394 typedef struct {
00395 
00396   const byte_t *filename;              /* Filename of in_stream, may be NULL */
00397 
00398   FILE 
00399    *in_stream,                           /* Stream to read from,may be NULL to just create a monitor */
00400    *err_stream;                          /* Stream to write error messages */
00401  
00402   aw_monitor_params_t *params;           /* Params to create a monitor */
00403 
00404   const byte_t *slavemaster;           /* host:ip of master */
00405 
00406   const byte_t *vars;                  /* comma delimited string of key=val,key=val */
00407 
00408 } aw_wire_mkmonitor_args_t;
00409 
00410 
00411 /* these are the signatures for the constructor functions that need to be present
00412    in a shared library to create a handler */
00413 typedef aw_handler_t *(*aw_wire_mkhandler_t)(aw_wire_mkhandler_args_t *);
00414 
00419 void aw_wire_free_obj(void *obj);
00420 
00427 aw_wire_keyword_t *aw_wire_keyfind(const byte_t *kw, aw_wire_keyword_t *kwlist);
00428 
00434 aw_wire_monitor_t *aw_wire_make(aw_wire_mkmonitor_args_t *args);
00435 
00436 
00441 void aw_wire_destroy(aw_wire_monitor_t *wm);
00442 
00451 aw_wire_obj_t *aw_wire_make_handler(aw_monitor_t *mon, const byte_t *name, 
00452                                     aw_wire_keyword_t *kwlist, FILE *message_stream);
00453 
00454 /*\@}*/
00455 #endif
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)