Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/net/netAddress.h

Go to the documentation of this file.
00001 // Filename: netAddress.h
00002 // Created by:  drose (08Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef NETADDRESS_H
00020 #define NETADDRESS_H
00021 
00022 #include <pandabase.h>
00023 #include <numeric_types.h>
00024 
00025 #include <prio.h>
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : NetAddress
00029 // Description : Represents a network address to which UDP packets may
00030 //               be sent or to which a TCP socket may be bound.
00031 ////////////////////////////////////////////////////////////////////
00032 class EXPCL_PANDA NetAddress {
00033 PUBLISHED:
00034   NetAddress();
00035   NetAddress(const PRNetAddr &addr);
00036 
00037   bool set_any(int port);
00038   bool set_localhost(int port);
00039   bool set_host(const string &hostname, int port);
00040 
00041   void clear();
00042 
00043   int get_port() const;
00044   void set_port(int port);
00045   string get_ip_string() const;
00046   PN_uint32 get_ip() const;
00047   PN_uint8 get_ip_component(int n) const;
00048 
00049   PRNetAddr *get_addr() const;
00050 
00051   void output(ostream &out) const;
00052 
00053 private:
00054   PRNetAddr _addr;
00055 };
00056 
00057 INLINE ostream &operator << (ostream &out, const NetAddress &addr) {
00058   addr.output(out);
00059   return out;
00060 }
00061 
00062 #endif
00063 

Generated on Fri May 2 00:40:35 2003 for Panda by doxygen1.3