00001 // 00002 // iodev.hh : Diffusion IO Devices Include File 00003 // authors : Fabio Silva 00004 // 00005 // Copyright (C) 2000-2002 by the University of Southern California 00006 // $Id: iodev.hh,v 1.6 2002/11/26 22:45:39 haldar Exp $ 00007 // 00008 // This program is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU General Public License, 00010 // version 2, as published by the Free Software Foundation. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License along 00018 // with this program; if not, write to the Free Software Foundation, Inc., 00019 // 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00020 // 00021 // 00022 00023 // This file defines the basic interface between diffusion device 00024 // drivers and the Diffusion Core (or the Diffusion Routing Library 00025 // API). It provides basic functionality to send and receive packets 00026 // and also keeps track of input/output file descriptors that can be 00027 // used on select(). 00028 00029 #ifndef _IODEV_HH_ 00030 #define _IODEV_HH_ 00031 00032 #ifdef HAVE_CONFIG_H 00033 #include "config.h" 00034 #endif // HAVE_CONFIG_H 00035 00036 #include <list> 00037 00038 #include "header.hh" 00039 #include "tools.hh" 00040 00041 using namespace std; 00042 00043 class DiffusionIO { 00044 public: 00045 DiffusionIO(); 00046 00047 virtual ~DiffusionIO(){ 00048 // Nothing to do 00049 }; 00050 00051 virtual void addInFDS(fd_set *fds, int *max); 00052 virtual bool hasFD(int fd); 00053 virtual int checkInFDS(fd_set *fds); 00054 virtual DiffPacket recvPacket(int fd) = 0; 00055 virtual void sendPacket(DiffPacket p, int len, int dst) = 0; 00056 00057 protected: 00058 int num_out_descriptors_; 00059 int num_in_descriptors_; 00060 int max_in_descriptor_; 00061 list<int> in_fds_; 00062 list<int> out_fds_; 00063 }; 00064 00065 typedef list<DiffusionIO *> DeviceList; 00066 00067 #endif // !_IODEV_HH_
1.3.3