[nox-dev] pyglue issues

2011-03-02 Thread MinChi Tseng
Hi All,
I found some issues in pyglue.cc
Correct me if I am wrong.
Thanks.

First,
For nw_src type it should use htonl instead of htons.

@@ -184,7 +185,7 @@
 PyObject* nw_src = PyDict_GetItemString(pymatch, "nw_src");
 if (nw_src) {
-match.nw_src = htons(from_python(nw_src));
+match.nw_src = htonl(from_python(nw_src));

@@ -201,7 +202,7 @@
 PyObject* nw_dst = PyDict_GetItemString(pymatch, "nw_dst");
 if (nw_dst) {
-match.nw_dst = htons(from_python(nw_dst));
+match.nw_dst = htonl(from_python(nw_dst));


Second,
For unsigned int type, the maximum value passed to long_from_python will become 
-1 instead of 4294967295 because of the long int maximum.
My intuitive solution is to extend the long int to long long int type.

Third,
PyInt_AsLong(obj) can't handle unsigned int value which over 2147483647.
PyInt_AsLong(obj) will return -1 and print "OverflowError: ..."
Then I change PyInt_AsLong(obj) to PyInt_AsUnsignedLongMask(obj).


/* Convert 'obj' into a long int, clamp the value between 'maximum' and
  * 'minimum', reporting any error, and return the final value. */
-static inline long int
+static inline long long int
 long_from_python(PyObject* obj, const char *type_name,
- long int minimum, long int maximum)
+ long long int minimum, long long int maximum)
 {
-long int value = PyInt_AsLong(obj);
+long long int value = PyInt_AsUnsignedLongMask(obj);
 if (value == -1 && PyErr_Occurred()) {
 PyErr_Print();
 } else if (value < minimum) {
 PyErr_Format(PyExc_RuntimeError,
- "Value %ld is less than minimum for %s (%ld)",
+ "Value %lld is less than minimum for %s (%lld)",
  value, type_name, minimum);
 value = minimum;
 } else if (value > maximum) {
 PyErr_Format(PyExc_RuntimeError,
- "Value %ld is greater than maximum for %s (%ld)",
+ "Value %lld is greater than maximum for %s (%lld)",
  value, type_name, maximum);
 value = maximum;
 }
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


Re: [nox-dev] [openflow-discuss] OpenFlow- NOX compiling problem

2011-03-02 Thread Srini Seetharaman
Hi Leonardo
This question is more appropriate for the nox-dev mailing list.

Could you please retry "git clone git://noxrepo.org/nox" ? The old
version you downloaded is for versions of OpenFlow earlier than 1.0.
We don't really support it at this point (I hope your NetFPGA switch
is also ver1.0)

Thanks
Srini.

On Wed, Mar 2, 2011 at 7:01 AM, Leonardo Linguaglossa
 wrote:
> Hello everybody,
> I am new to OpenFlow and NOX controller and I am trying to install NOX from
> source.
>
> My configuration is a NetFPGA Cube, with all package installed and also the
> openflow is already installed, but I am having problems about the
> installation of Nox.
>
> At first I followed what is said in the install guide using git, but I
> received:
>
>git clone git://noxrepo.org/nox
> Cloning into noxcore...
> fatal: The remote end hung up unexpectedly
>
>
> So I tried to download the source and do the installation in this way, but
> after doing the ./configure (gone well), when I do the make command, the
> output is:
>
>
> openflow-event.cc: At global scope:
> openflow-event.cc:68: error: expected ‘,’ or ‘...’ before ‘*’ token
> openflow-event.cc:68: error: ISO C++ forbids declaration of
> ‘ofp_flow_expired’ with no type
> openflow-event.cc: In function
> ‘vigil::Event*::handle_flow_expired(vigil::datapathid, int)’:
> openflow-event.cc:72: error: ‘ofe’ was not declared in this scope
> openflow-event.cc:72: error: ‘buf’ was not declared in this scope
> openflow-event.cc: In function ‘vigil::Event*
> vigil::openflow_packet_to_event(vigil::datapathid,
> std::auto_ptr)’:
> openflow-event.cc:277: error: ‘OFPT_FLOW_EXPIRED’ was not declared in this
> scope
> openflow-event.cc:278: error: no matching function for call to
> ‘handle_packet(vigil::Event* (&)(vigil::datapathid, int),
> vigil::datapathid&, const ofp_header*&, std::auto_ptr&)’
> make[5]: *** [openflow-event.lo] Error 1
> make[5]: Leaving directory `/home/netfpga2/nox/nox-0.4.0~beta/src/lib'
> make[4]: *** [all] Error 2
> make[4]: Leaving directory `/home/netfpga2/nox/nox-0.4.0~beta/src/lib'
> make[3]: *** [all-recursive] Error 1
> make[3]: Leaving directory `/home/netfpga2/nox/nox-0.4.0~beta/src'
> make[2]: *** [all] Error 2
> make[2]: Leaving directory `/home/netfpga2/nox/nox-0.4.0~beta/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/netfpga2/nox/nox-0.4.0~beta'
> make: *** [all] Error 2
>
> I hope you could help me, because I don't know how to overcome this problem.
> Regards,
>
> Leonardo
>
> ___
> openflow-discuss mailing list
> openflow-disc...@lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>
>

___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org