00001 // -*- C++ -*- 00002 // Definitions for holding a TCP socket address 00003 // 00004 // ***** BEGIN LICENSE BLOCK ***** 00005 // Version: MPL 1.1/GPL 2.0/LGPL 2.1 00006 // 00007 // The contents of this file are subject to the Mozilla Public License 00008 // Version 1.1 (the "License"); you may not use this file except in 00009 // compliance with the License. You may obtain a copy of the License at 00010 // http://www.mozilla.org/MPL/ 00011 // 00012 // Software distributed under the License is distributed on an "AS IS" 00013 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00014 // the License for the specific language governing rights and limitations 00015 // under the License. 00016 // 00017 // The Original Code is the consmgr network/serial-line monitoring package. 00018 // 00019 // The Initial Developer of the Original Code is Chris P. Ross. 00020 // Portions created by the Initial Developer are Copyright (C) 2000-2008 00021 // the Initial Developer. All Rights Reserved. 00022 // 00023 // Contributor(s): 00024 // Geoff Adams 00025 // 00026 // Alternatively, the contents of this file may be used under the terms of 00027 // either the GNU General Public License Version 2 or later (the "GPL"), or 00028 // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 00029 // in which case the provisions of the GPL or the LGPL are applicable instead 00030 // of those above. If you wish to allow use of your version of this file only 00031 // under the terms of either the GPL or the LGPL, and not to allow others to 00032 // use your version of this file under the terms of the MPL, indicate your 00033 // decision by deleting the provisions above and replace them with the notice 00034 // and other provisions required by the GPL or the LGPL. If you do not delete 00035 // the provisions above, a recipient may use your version of this file under 00036 // the terms of any one of the MPL, the GPL or the LGPL. 00037 // 00038 // ***** END LICENSE BLOCK ***** 00039 00040 #ifndef __IPSOCKADDR_H 00041 #define __IPSOCKADDR_H 00042 00043 extern "C" { 00044 #include <sys/types.h> 00045 #include <netdb.h> 00046 } 00047 00048 // Get the base class 00049 #include "sockaddr.h" 00050 00059 class IPSocketAddress : public SocketAddress { 00060 public: 00061 IPSocketAddress(const struct sockaddr *initaddr) : SocketAddress(initaddr) {} 00062 IPSocketAddress(const std::string &address, int port); 00063 ~IPSocketAddress(); 00064 00065 // An additional inquiry for IPSocketAddress... 00066 u_short port() const; 00067 00068 // Generate an ID string to indicate what we're connected to... 00069 std::string get_id() const; 00070 }; 00071 00072 #endif /* __IPSOCKADDR_H */