conexus logo

ll_packet.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef CONEXUSLL_PACKET_H
00020 #define CONEXUSLL_PACKET_H
00021 
00022 #include <conexus/socket.h>
00023 #include <conexus/ll_address.h>
00024 
00034 namespace Conexus
00035 {
00036 
00037   namespace LL
00038   {
00039 
00047     class Packet : public Socket
00048     {
00049       protected:
00050 
00051         Packet( int protocol = ETH_P_IP, int type = SOCK_DGRAM );
00052 
00053       public:
00054 
00055         typedef ConexusPointer<Packet> pointer;
00056 
00057         CONEXUS_ENDPOINT_GENERIC_CREATE();
00058 
00059         static pointer create( int protocol = ETH_P_IP, int type = SOCK_DGRAM );
00060 
00061         virtual ~Packet() throw();
00062 
00063         virtual void bind() throw ( bind_exception );
00064 
00065         virtual void bind( Address& a ) throw ( bind_exception );
00066 
00067         void set_interface( int );
00068 
00069         void set_interface( const std::string );
00070 
00071         int interface_index( const std::string name );
00072 
00073         std::string interface_name( int ifindex );
00074 
00075         std::vector<std::string> interface_names();
00076 
00077         virtual size_t input_available() throw();
00078 
00079       protected:
00080         Address m_address;
00081         int m_protocol;
00082 
00083         virtual size_t write_data( const Data data, Timeout timeout ) throw ( write_exception );
00084 
00085     };
00086 
00087   }
00088 
00089 }
00090 
00091 #endif

Generated on Wed Jul 8 15:50:07 2009 for conexus by doxygen 1.5.8