Mixe for Privacy and Anonymity in the Internet
CATargetInterface.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000, The JAP-Team 
00003 All rights reserved.
00004 Redistribution and use in source and binary forms, with or without modification, 
00005 are permitted provided that the following conditions are met:
00006 
00007   - Redistributions of source code must retain the above copyright notice, 
00008     this list of conditions and the following disclaimer.
00009 
00010   - Redistributions in binary form must reproduce the above copyright notice, 
00011     this list of conditions and the following disclaimer in the documentation and/or 
00012     other materials provided with the distribution.
00013 
00014   - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors 
00015     may be used to endorse or promote products derived from this software without specific 
00016     prior written permission. 
00017 
00018   
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027 */
00028 
00029 class CATargetInterface
00030   {
00031     public:
00032       CATargetInterface(TargetType target_t,NetworkType net_t,CASocketAddr* p_addr)
00033         {
00034           set(target_t,net_t,p_addr);
00035         }
00036 
00037       CATargetInterface()
00038         {
00039           target_type=TARGET_UNKNOWN;
00040           net_type=UNKNOWN_NETWORKTYPE;
00041           addr=NULL;
00042         }
00043 
00044       SINT32 cloneInto(CATargetInterface& oTargetInterface) const
00045         {
00046           oTargetInterface.net_type=net_type;
00047           oTargetInterface.target_type=target_type;
00048           oTargetInterface.addr=addr->clone();
00049           return E_SUCCESS;
00050         }
00051 
00052       SINT32 set(TargetType target_t,NetworkType net_t,CASocketAddr* p_addr)
00053         {
00054           target_type=target_t;
00055           net_type=net_t;
00056           addr=p_addr;
00057           return E_SUCCESS;
00058         }
00059 
00060       SINT32 set(CATargetInterface& source)
00061         {
00062           return set(source.target_type,source.net_type,source.addr);
00063         }
00064 
00065       SINT32 set(CATargetInterface* source)
00066         {
00067           return set(source->target_type,source->net_type,source->addr);
00068         }
00069 
00070       TargetType getTargetType() const
00071         {
00072           return target_type;
00073         }
00074 
00075       CASocketAddr* getAddr() const
00076         {
00077           return addr;
00078         }
00079 
00080       SINT32 cleanAddr()
00081         {
00082           delete addr;
00083           addr=NULL;
00084           return E_SUCCESS;
00085         }
00086 
00087     private:
00088       CASocketAddr* addr;
00089       TargetType target_type;
00090       NetworkType net_type;
00091   };