📄 ipaddress.h
字号:
#ifndef IPADDRESS_H#define IPADDRESS_H/********************************************************************* $Id: IPAddress.h,v 1.2 1999/08/31 02:22:05 cullen Exp $ ********************************************************************* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. In addition to the terms and conditions set forth in the GNU Lesser General Public License, as a condition of using this library you are required to grant to all users of this library or any implementation utilizing or derived from this library a reciprocal, no cost, worldwide, perpetual, non-exclusive, non-transferable, unrestricted license to your claims of all patents and patent applications throughout the world that are infringed by the library or any implementation utilizing or derived from this library. In the event you redistribute this library or any implementation utilizing or derived from this library, you must prominently display the foregoing terms and conditions with the library or the implementation utilizing or derived from this library. In the event of a conflict of terms between the foregoing license grant and the terms set forth in the GNU Lesser General Public License, the foregoing terms and conditions shall be deemed to govern. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not; write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. Copyright 1999 Vovida Networks, Inc. All Rights Reserved. ********************************************************************* $Log: IPAddress.h,v $ Revision 1.2 1999/08/31 02:22:05 cullen updated header **********************************************************************/#include <iostream.h>#include <errno.h>#include <sys/socket.h>#include <netinet/in.h>#include <string>#include "Object.h"namespace mh323{ const unsigned int iDefaultPort=1720; //------------------------------------------------------------------------------ // IPAddress class - ip address storing and translating class IPAddress :public Object { public: IPAddress(); IPAddress(const std::string & xAddress); IPAddress(char* pcAddress, unsigned int iPort); IPAddress(unsigned long lAddress, unsigned int iPort); // IPAddress( const IPAddress & rxOther);// IPAddress& operator= ( const IPAddress & rxOther); void set(const char* pcAddress, unsigned int iPort); void set(const std::string & xAddress); void set(unsigned long lAddress, unsigned int iPort); void set(unsigned long lAddress); void setPort(unsigned int iPort); void addressToChar(char * pcAddress) const; std::string getHost( ) const; unsigned long getAddress() const; unsigned int getPort() const; unsigned char operator [] ( int nth) const; //friend ostream& operator << (ostream & xStr, const IPAddress& xAddress) ; bool operator < (const IPAddress & xAddress ) const; operator std::string(); virtual ostream & printOn(ostream & xStr) const; protected: unsigned char m_pcAddress[4]; int m_iPort; };}#endif IPADDRESS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -