<br>Hi, Juli,<div><br></div><div>Thank you so much for all the help. That was very helpful! </div><div><br></div><div><br><div class="gmail_quote">On Sat, Mar 2, 2013 at 9:35 AM, Juli Mallett <span dir="ltr"><<a href="mailto:juli@clockworksquid.com" target="_blank">juli@clockworksquid.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Boxiang,<br>
<br>
With the changes I've made to the configuration system internally<br>
(configuration files should still be the same), I think you'll have an<br>
easier time seeing now how to create a proxy instance.  Look at<br>
wanproxy_config_class_proxy.cc, namely.<br>
<br>
You'd want to do something like:<br>
<br>
new ProxyListener(co->name_, interface_codec, peer_codec,<br>
interface->family_, interface_address, peer->family_, peer_address);<br>
<br>
Where co->name_ is a string giving a name to this proxy instance.<br>
<br>
interface_codec is a pointer to a WANProxyCodec structure, which you<br>
can see in wanproxy_codec.h; just create an XCodec instance if you<br>
need one, and set compression options.  Likewise for peer_codec.<br>
<br>
interface->family_ gives the address family; you probably want<br>
SocketAddressFamilyIP, or maybe SocketAddressFamilyIPv4 if you know<br>
it's IPv4, etc.  Same for peer->family_.<br>
<br>
interface_address and peer_address are both strings.<br>
interface_address is the address to listen on, and peer_address is the<br>
address to connect to.  So interface_address might be something like<br>
"[0.0.0.0]:4290" to listen on port 4290 of all IPv4 interfaces.  And<br>
then peer_address might be "[10.10.0.90]:4390" to connect to port 4390<br>
on 10.10.0.90.<br>
<br>
Note that the address strings do not need the brackets if they are not<br>
IPv6 addresses, but I tend to use them anyway.  You can also use DNS<br>
names instead, e.g. "<a href="http://wanproxy1.co.us.example.com:4390" target="_blank">wanproxy1.co.us.example.com:4390</a>" if your peer<br>
has a hostname associated with it.<br>
<br>
I hope that's enough for you; let me know if you need something more.<br>
<br>
Thanks,<br>
Juli.<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Feb 19, 2013 at 12:47 AM, Boxiang Pan <<a href="mailto:aquarypbx@gmail.com">aquarypbx@gmail.com</a>> wrote:<br>
> Hi, Juli,<br>
><br>
> We really appreciate your quick reply. Yes, it will be very helpful for us<br>
> if you could provide sample code for creating a proxy instance with C++, and<br>
> the interface code where we may use python to call.  I don't really<br>
> understand what you mean by "simple binary protocol over TCP, inject<br>
> configuration over TCP", do you mean sending the conf files over TCP to<br>
> WANProxy instances?<br>
><br>
> For now, I think starting wanproxy from python is enough for us, we don't<br>
> need to worry about control at this time.<br>
><br>
> Details about our code flow:<br>
><br>
> So we have a open flow controller that runs on a VM and rest of the networks<br>
> can be tenants (or clients). Clients establish a tcp connection and send a<br>
> service request via configuration file over TCP to the controller describing<br>
> the type of functionality they want to avail (in our case its WANProxy) and<br>
> also will tell a network path (or a set of switches) over which client wants<br>
> the reservations to be made. This request is handled by an allocator which<br>
> takes all the parameters from config file, passes the control to a module(we<br>
> have to implement this) which will need to communicate with WANProxy<br>
> (already installed on the switches in network path) and make the necessary<br>
> reservations. Once this set up is done, we will repeatedly send same large<br>
> file to measure the performance of WANProxy.<br>
><br>
> What interface code do you think might be necessary?<br>
><br>
> Thank you very much.<br>
><br>
> On Sun, Feb 17, 2013 at 4:56 PM, Juli Mallett <<a href="mailto:juli@clockworksquid.com">juli@clockworksquid.com</a>><br>
> wrote:<br>
>><br>
>> Boxiang,<br>
>><br>
>> Very excited to hear about your project.<br>
>><br>
>> Really, if you're willing to write some bindings for the C++ code,<br>
>> it's probably better to entirely do without the configuration system<br>
>> if you're at all interested in scripting WANProxy.<br>
>><br>
>> You would want to look at the ProxyListener and SSHProxyListener<br>
>> classes right now; creating one of those is what creates a proxy<br>
>> instance, and then you need only call 'event_main()' to get things off<br>
>> and running.  I can provide sample code for creating a proxy instance<br>
>> (SSH or otherwise) with C++ code instead of a config file if that<br>
>> would be helpful for you.<br>
>><br>
>> The drawback to that is that if I change anything in WANProxy, there's<br>
>> a possibility that your bindings would need updated.  I could also<br>
>> provide a simple binary protocol over TCP for creating proxy<br>
>> instances, or even set up a listener that allows one to inject<br>
>> configuration over TCP.<br>
>><br>
>> Control is a trickier question.  Right now there's little in the way<br>
>> of statistics and reporting; you can't even easily get a list of<br>
>> current connections being proxied.  What kinds of control do you need?<br>
>>  It may be that I can point you to something that's working right now,<br>
>> or it may be that I need to add some code to provide an interface for<br>
>> your project.<br>
>><br>
>> Thanks,<br>
>> Juli.<br>
>><br>
>> On Sun, Feb 17, 2013 at 1:00 PM, Boxiang Pan <<a href="mailto:bopan@ucsd.edu">bopan@ucsd.edu</a>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > We are a group of graduate students from UCSD, and we are working on a<br>
>> > class<br>
>> > project using WANProxy. Our goal is to be able to start and control<br>
>> > WANProxy<br>
>> > from an openflow based controller written in python. We already have the<br>
>> > openflow controller in python, and we would like to let it "talk" to<br>
>> > WANProxy. So instead of directly type "wanproxy -c client.conf" in the<br>
>> > terminal, we hope to type in a command in the openflow controller, and<br>
>> > then<br>
>> > let it start/control the WANProxy. We'd appreciate it very much if you<br>
>> > could<br>
>> > give us some guideline on how to integrate WANProxy with openflow<br>
>> > controller, specifically which parts of the code in WANProxy are the<br>
>> > interface/API that we should study? And what is the best tool to wrap<br>
>> > WANProxy into python?<br>
>> ><br>
>> > Thank you for your help and suggestions.<br>
>> ><br>
>> > --<br>
>> ><br>
>> > Boxiang Pan<br>
>> ><br>
>><br>
>> --<br>
>><br>
>> Boxiang Pan<br>
>><br>
>> Department of Electrical and Computer Engineering<br>
>> University of California, San Diego<br>
>> Tel: <a href="tel:858-999-7655" value="+18589997655">858-999-7655</a><br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><font color="#663333"><span style="font-size:large"><font face="verdana, sans-serif">潘博翔</font></span></font></div><font color="#663333"><font face="verdana, sans-serif">Boxiang Pan</font><br>
<br></font><div><div><font color="#663333">Department of Electrical and Computer Engineering</font></div><div><font color="#663333">University of California, San Diego </font></div><div><font color="#663333">Tel: 858-999-7655<br>
</font><br></div><div><br></div></div>
</div>