00001 /* $Id: gateway.hh,v 1.2 2003/07/22 05:08:42 tetron Exp $ */ 00002 00003 00004 /** @file gateway.hh Defines MetaObject class for "misc:gateway" object type (revision 0). */ 00005 00006 /* This file was generated by otd2cpp.pl, a script for VOS by Reed Hedges 00007 * <reed@zerohour.net> and Peter Amstutz <tetron@interreality.org> 00008 * 00009 * Search for TODO for stuff that needs editing. You will want to especially fill 00010 * in constructors, destructors, message handlers, non-property subobjects... 00011 * 00012 * The authors of otd2cpp make no guarantee that this code will work, or even 00013 * that it even is safe to run. Use it at your own risk. 00014 */ 00015 00016 #ifndef _MISC_GATEWAY_HH_ 00017 #define _MISC_GATEWAY_HH_ 00018 00019 00020 #include <vos/corelibs/vos/vos.hh> 00021 #include <vos/metaobjects/property/property.hh> 00022 00023 00024 /** MetaObject implementing Gateway Object Type. 00025 00026 Protocol for setting up port forwards for VOS sessions through a NAT gateway. 00027 00028 */ 00029 00030 class Gateway : public virtual MetaObject { 00031 00032 protected: 00033 PropertyAccessControl* accessControl; 00034 00035 00036 public: 00037 00038 /** Constructor */ 00039 Gateway(MetaObject* superobject); 00040 00041 /** Destructor */ 00042 virtual ~Gateway(); 00043 00044 /** Return type string ("misc:gateway") */ 00045 virtual const string getType(); 00046 00047 /** Register Extenders */ 00048 static void registerExtenders(); 00049 00050 /** Set default access control policy */ 00051 virtual void setPropertyAccessControl(PropertyAccessControl* ac); 00052 00053 /** Get default access control policy */ 00054 virtual PropertyAccessControl* getPropertyAccessControl(); 00055 00056 /** @name Actuators. User-functions that correspond to 00057 message actions. */ 00058 //@{ 00059 00060 /** Perform request-forward. (Request a port forward. Sent from 00061 the client systemon the localnet to the firewall. The gateway 00062 program on thefirewall should set up a port forward (either a 00063 simple user-levelredirect, or using available operating system 00064 firewalling such asLinux's iptables) to the client site so long 00065 as the client siteremains connected to the firewall.) */ 00066 virtual void requestForward(LocalSocketSite* ls) = 0; 00067 00068 //@} 00069 }; 00070 00071 /** Local version of Gateway. */ 00072 00073 class LocalGateway : public virtual Gateway { 00074 00075 public: 00076 00077 /** Constructor */ 00078 LocalGateway(MetaObject* superobject); 00079 00080 /** Destructor */ 00081 ~LocalGateway(); 00082 00083 /** Initialize required subproperties with given access control. */ 00084 virtual void initialize(PropertyAccessControl* ac); 00085 00086 /** Initialize required subproperties. If access control has been 00087 previously set with initialize(PropertyAccessControl*) or 00088 setPropertyAccessControl(), then that policy will be used. Otherwise, 00089 NoPropertyAccessControl will be used. 00090 */ 00091 virtual void initialize(); 00092 00093 /** Static generator, for factory. */ 00094 static MetaObject* new_LocalGateway(MetaObject* superobject, const string& type); 00095 00096 /** @name Actuators. These methods correspond to messages. */ 00097 //@{ 00098 00099 /** Perform request-forward. (Request a port forward. Sent from 00100 * the client systemon the localnet to the firewall. The gateway 00101 * program on thefirewall should set up a port forward (either a 00102 * simple user-levelredirect, or using available operating system 00103 * firewalling such asLinux's iptables) to the client site so long 00104 * as the client siteremains connected to the firewall.) */ 00105 virtual void requestForward(LocalSocketSite* ls); 00106 00107 //@} 00108 00109 protected: 00110 00111 /** @name Message Handlers */ 00112 00113 /** Handle message request-forward (Request a port forward. Sent 00114 * from the client systemon the localnet to the firewall. The 00115 * gateway program on thefirewall should set up a port forward 00116 * (either a simple user-levelredirect, or using available 00117 * operating system firewalling such asLinux's iptables) to the 00118 * client site so long as the client siteremains connected to the 00119 * firewall.) */ 00120 virtual void handleRequestForward(Message* m); 00121 }; 00122 00123 /** Remote proxy for Gateway */ 00124 00125 class RemoteGateway : public virtual Gateway { 00126 00127 public: 00128 00129 /** Constructor */ 00130 RemoteGateway(MetaObject* superobject); 00131 00132 /** Destructor */ 00133 virtual ~RemoteGateway(); 00134 00135 /** Static generator, for factory. */ 00136 static MetaObject* new_RemoteGateway(MetaObject* superobject, const string& type); 00137 00138 /** @name Actuators. These are user-functions corresponding to 00139 messages. The remote actuators marshal arguments and send a 00140 message to the Local object. */ 00141 //@{ 00142 00143 /** Send a request-forward messsage to the local object. */ 00144 virtual void requestForward(LocalSocketSite* ls); 00145 00146 //@} 00147 protected: 00148 00149 /** @name Update Handlers. Handlers for remote update messages */ 00150 //@{ 00151 00152 /** Handle a request-forward-reply messsage from the local object. */ 00153 virtual void handleRequestForwardReply(Message* m); 00154 00155 //@} 00156 }; 00157 00158 00159 #endif // #ifndef _MISC_GATEWAY_HH_ 00160