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

netifhandler.h

Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 2004 Russell Leighton
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 */
00018 
00019 
00020 
00021 
00022 #ifndef __AWHANDLER_NETIF__
00023 #define __AWHANDLER_NETIF__
00024 
00025 #include "monitor.h"
00026 #include "wire.h"
00027 
00190 /*
00191 
00192 Changes:
00193 
00194 02/11/04 Russell Leighton
00195 Port to handler
00196 
00197 */
00198 
00199 
00200 
00204 typedef struct {
00205 
00206   aw_event_sig_t
00207     rate,
00208     bytes,
00209     packets,
00210     errs,
00211     drop,
00212     fifo,
00213     frame,
00214     compz,
00215     multi;
00216 
00217 } aw_netifhandler_rxevents_t;
00218 
00222 typedef struct {
00223 
00224   aw_event_sig_t
00225     rate,
00226     bytes,
00227     packets,
00228     errs,
00229     drop,
00230     fifo,
00231     colls,
00232     carrier,
00233     compz;
00234 
00235 } aw_netifhandler_txevents_t;
00236 
00240 typedef struct {
00241 
00242   aw_event_sig_t
00243    down;
00244 
00245   aw_netifhandler_rxevents_t
00246    rx;
00247 
00248   aw_netifhandler_txevents_t
00249    tx;
00250 
00251 } aw_netifhandler_events_t;
00252 
00256 typedef struct {
00257 
00258   /* remember the last counts so we can estimate bytes/sec */
00259   int64_t
00260    last_rx_bytes,
00261    last_tx_bytes;
00262 
00263   /* remember the time of last handler() so we can estimate bytes/sec */
00264   aw_timestamp_t
00265    last_handlertime;
00266 
00267 } aw_netifhandler_state_t;
00268 
00272 typedef struct {
00273 
00274   aw_handler_t 
00275     handler_header;
00276 
00277   aw_netifhandler_events_t
00278    events;
00279 
00280   /* name of net device */
00281   byte_t
00282    *dev;
00283 
00284   /* strlen(dev) */
00285   byte_t
00286    devlen;
00287 
00288   aw_netifhandler_state_t
00289    state;
00290 
00291 } aw_netifhandler_t ;
00292 
00303 aw_netifhandler_t *aw_create_netifhandler(const aw_netifhandler_events_t *events,
00304                                           const byte_t *dev,
00305                                           int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00306                                           int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00307                                           const aw_alarm_sched_t *sched,
00308                                           aw_logger_t *logger
00309                                           );
00310 
00315 void aw_free_netifhandler(aw_netifhandler_t *p);
00316 
00320 aw_handler_t *aw_wire_netifhandler(aw_wire_mkhandler_args_t *args);
00321 
00322 #endif
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)