Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

Layer2.h

00001 /*** This Programs/Libraries are (C)opyright by Sebastian Krahmer.
00002  *** You may use it under the terms of the GPL. You should have
00003  *** already received the file COPYING that shows you your rights.
00004  *** Please look at COPYING for further license-details.
00005  ***  
00006  *** THERE IS ABSOLUTELY NO WARRANTY. SO YOU USE IT AT YOUR OWN RISK.
00007  *** IT WAS WRITTEN IN THE HOPE THAT IT WILL BE USEFULL. I AM NOT RESPONSIBLE
00008  *** FOR ANY DAMAGE YOU MAYBE GET DUE TO USING MY PROGRAMS.
00009  ***/
00010 #ifndef _LAYER2_H_
00011 #define _LAYER2_H_
00012 
00013 #include "config.h"
00014 #include "usi++/usi-structs.h"
00015 #include "RX.h"
00016 #include "TX.h"
00017 
00018 #include <stdio.h>
00019 
00020 namespace usipp {
00021 
00025 class Layer2 {
00026 private:
00027         RX *d_rx;               // for receiving
00028         TX *d_tx;               // for transmitting data
00029 public:
00034         Layer2(RX *r = NULL, TX *t = NULL);
00035         
00036         
00037         virtual ~Layer2() {}
00038 
00040         virtual int sniffpack(void *, size_t);
00041 
00043         virtual int sendpack(void *buf, size_t len, struct sockaddr *);
00044 
00046         virtual int init_device(char *dev, int promisc, size_t snaplen);
00047 
00049         int setfilter(char *f); 
00050 
00052         int timeout(struct timeval);
00053 
00055         bool timeout();
00056         
00058         TX *register_tx(TX *t) { TX *r = d_tx; d_tx = t; return r; }
00059         
00061         RX *register_rx(RX *r) { RX *ret = d_rx; d_rx = r; return ret; }
00062 
00064         TX *tx() { return d_tx; }
00065 
00067         RX *rx() { return d_rx; }       
00068 };
00069 
00070 } // namespace usipp
00071 #endif

Generated at Fri May 11 13:02:56 2001 for libusi++ by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000