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 CONEXUS_IPV4IP_H 00020 #define CONEXUS_IPV4IP_H 00021 00022 #include <conexus/ip.h> 00023 #include <conexus/ipv4_address.h> 00024 00025 namespace Conexus 00026 { 00027 00028 namespace IPv4 00029 { 00053 class IP : public Conexus::IP 00054 { 00055 00056 protected: 00057 00062 IP( int type = -1, int protocol = 0 ); 00063 00064 public: 00066 typedef ConexusPointer<IP> pointer; 00067 00068 virtual ~IP() throw(); 00069 00071 virtual void bind() throw ( bind_exception ); 00072 00074 virtual void bind( const Conexus::Address& a ) throw ( bind_exception ); 00075 00077 virtual void connect() throw ( connect_exception ); 00078 00080 virtual void connect( const Address& a ) throw ( connect_exception ); 00081 00083 virtual Address& local_address(); 00084 00086 virtual Address& remote_address(); 00087 00088 virtual IPAddressInterface& generic_local_address(); 00089 00090 virtual IPAddressInterface& generic_remote_address(); 00091 00092 virtual void set_remote_address( const Address& addr ); 00093 00094 virtual void set_remote_address( uint32_t addr, uint16_t port ); 00095 00096 virtual void set_remote_address( const std::string& addr, uint16_t port ); 00097 00098 virtual void unset_remote_address(); 00099 00100 virtual void set_local_address( const Address& addr ); 00101 00102 virtual void set_local_address( uint32_t addr, uint16_t port ); 00103 00104 virtual void set_local_address( const std::string& addr, uint16_t port ); 00105 00106 protected: 00107 Address m_local_address; 00108 Address m_remote_address; 00109 bool m_remote_address_set; 00110 00111 virtual void on_local_address_changed( ); 00112 virtual void on_remote_address_changed( ); 00113 00114 void on_local_address_changed_proxy( ); 00115 void on_remote_address_changed_proxy( ); 00116 }; 00117 00118 } 00119 00120 } 00121 00122 #endif