00001 #ifndef ADDRESS_BASE_CLASS 00002 #define ADDRESS_BASE_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : address_base * 00007 * Author : Chris Koeritz * 00008 * * 00009 * Purpose: * 00010 * * 00011 * Provides a way to describe an endpoint for communication. * 00012 * * 00013 ******************************************************************************* 00014 * Copyright (c) 1995-$now By Author. This program is free software; you can * 00015 * redistribute it and/or modify it under the terms of the GNU General Public * 00016 * License as published by the Free Software Foundation; either version 2 of * 00017 * the License or (at your option) any later version. This is online at: * 00018 * http://www.fsf.org/copyleft/gpl.html * 00019 * Please send any updates to: fred@gruntose.com * 00020 \*****************************************************************************/ 00021 00022 #include "sockets_dll.h" 00023 00024 #include <basis/object_base.h> 00025 #include <basis/packable.h> 00026 00027 // forward. 00028 class machine_uid; 00029 00030 class SOCKETS_CLASS_STYLE address_base 00031 : public packable, 00032 public virtual object_base 00033 { 00034 public: 00035 virtual ~address_base(); 00036 00037 virtual bool same_host(const address_base &to_compare) const = 0; 00038 virtual bool same_port(const address_base &to_compare) const = 0; 00039 // returns true if the host or port are identical. 00040 00041 virtual bool shareable(const address_base &to_compare) const = 0; 00042 // returns true if the two transports can be shared. 00043 00044 virtual istring text_form() const = 0; 00045 // returns a readable string representing the address. 00046 00047 virtual int packed_size() const = 0; 00048 // returns the size that this object should take when packed into bytes. 00049 00050 // these flip the address into a string and back. this is different from 00051 // text_form() because the reversal must be possible. 00052 virtual istring tokenize() const = 0; 00053 virtual bool detokenize(const istring &info) = 0; 00054 00055 virtual machine_uid convert() const = 0; 00056 // returns the address in the uniquifying format. 00057 00058 virtual address_base *create_copy() const = 0; 00059 // creates a new address that's a copy of this one. note that this 00060 // allocates memory that must be deleted by the caller. 00061 }; 00062 00063 #endif 00064
1.5.1