Page 1 of 1

build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 23 Jun 2012, 16:04
by douggiem
I'm trying to build Zero Ballistics. That what I've got:

Code: Select all
[ 17%] Building CXX object libs/network/CMakeFiles/network.dir/src/MultipleConnectPlugin.cpp.o
[ 17%] Building CXX object libs/network/CMakeFiles/network.dir/src/NetworkUtils.cpp.o
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp: In function ‘void network::initializeSecurity(RakPeerInterface*, const string&, bool)’:
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:65:2: error: ‘big’ has not been declared
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:65:11: error: expected ‘;’ before ‘e’
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:66:2: error: ‘RSA_BIT_SIZE’ was not declared in this scope
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:66:15: error: expected ‘;’ before ‘n’
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:68:25: error: ‘e’ was not declared in this scope
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:69:25: error: ‘n’ was not declared in this scope
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:79:21: error: ‘RSA_BIT_SIZE’ was not declared in this scope
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:79:35: error: ‘p’ was not declared in this scope
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:79:36: error: ‘BIGHALFSIZE’ was not declared in this scope
/home/username/Development/ZeroBallistics/zb-svn/trunk/code/libs/network/src/NetworkUtils.cpp:80:35: error: ‘q’ was not declared in this scope
make[2]: *** [libs/network/CMakeFiles/network.dir/src/NetworkUtils.cpp.o] Error 1
make[1]: *** [libs/network/CMakeFiles/network.dir/all] Error 2
make: *** [all] Error 2


Any suggestions?

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 23 Jun 2012, 16:07
by douggiem
By the way, I do have raknet-v3.401 (there's no sources for raknet 3.261 mentioned on http://sourceforge.net/apps/mediawiki/z ... knet_3.261 inside http://www.raknet.com/raknet/downloads/).

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 23 Jun 2012, 17:17
by douggiem
Studying raknet-3.401/Samples/Encryption/Encryption.cpp

Code: Select all
int main(void)
{
        char str[256];
        bool keyLoaded; // Does D,E,N have values?

        // RSACrypt is a class that handles RSA encryption/decryption internally
        RSACrypt rsacrypt;

        uint32_t e;
        uint32_t modulus[RAKNET_RSA_FACTOR_LIMBS];
        // e and modulus form the public key

        // p,q is the private key
        uint32_t p[RAKNET_RSA_FACTOR_LIMBS/2],q[RAKNET_RSA_FACTOR_LIMBS/2];

        /*
        // RSACrypt is a class that handles RSA encryption/decryption internally
        big::RSACrypt<RSA_BIT_SIZE> rsacrypt;

        // These are the sizes necessary for e,n,p,q
        // e,n is the public key
        // p,q is the private key
        big::u32 e;
        RSA_BIT_SIZE n;
        BIGHALFSIZE(RSA_BIT_SIZE, p);
        BIGHALFSIZE(RSA_BIT_SIZE, q);
        */


I found a solution:

Code: Select all
Index: libs/network/src/NetworkUtils.cpp
===================================================================
--- libs/network/src/NetworkUtils.cpp   (revision 4455)
+++ libs/network/src/NetworkUtils.cpp   (working copy)
@@ -8,7 +8,6 @@
#include <raknet/StringCompressor.h>
#include <raknet/MessageIdentifiers.h>

-
#include "Scheduler.h"
#include "Console.h"
#include "Matrix.h"
@@ -62,8 +61,8 @@

     if (public_key)
     {
-       big::u32 e;
-       RSA_BIT_SIZE n;
+        uint32_t e;
+        uint32_t n[RAKNET_RSA_FACTOR_LIMBS];

         in.read((char*)&e, sizeof(e));
         in.read((char*)&n, sizeof(n));
@@ -76,8 +75,7 @@
         iface->InitializeSecurity((const char*)&e, (const char*)&n, NULL, NULL);
     } else
     {
-        BIGHALFSIZE(RSA_BIT_SIZE, p);
-        BIGHALFSIZE(RSA_BIT_SIZE, q);
+        uint32_t p[RAKNET_RSA_FACTOR_LIMBS/2],q[RAKNET_RSA_FACTOR_LIMBS/2];

         in.read((char*)&p, sizeof(p));
         in.read((char*)&q, sizeof(q));

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 03 Jul 2012, 09:42
by Michael
douggiem wrote:By the way, I do have raknet-v3.401 (there's no sources for raknet 3.261 mentioned on http://sourceforge.net/apps/mediawiki/z ... knet_3.261 inside http://www.raknet.com/raknet/downloads/).


We have uploaded the tar ball of raknet_3.261, it is linked on the build instructions page right below the raknet section:
raknet3.261.tar.gz

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 04 Jul 2012, 20:57
by douggiem
Michael wrote:We have uploaded the tar ball of raknet_3.261, it is linked on the build instructions page right below the raknet section:
raknet3.261.tar.gz


I do still wonder about license issues... And why not to try to migrate to more modern version?

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 05 Jul 2012, 10:07
by Michael
RakNet was and still is free for Indy devs, so i don't see a problem here with licensing.
http://www.jenkinssoftware.com/pricing.html

It would be great if you would like to upgrade to a newer version of Raknet. We once tried and experienced some wierd behaviour in network physics and return to an older version, but if you want to make the effort i'll support whenever i can.

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 23 Jul 2012, 17:51
by douggiem
It would be great if you would like to upgrade to a newer version of Raknet. We once tried and experienced some wierd behaviour in network physics and return to an older version, but if you want to make the effort i'll support whenever i can.


I'm now working on extracting parts from raknet and "re-writing" it, thus eliminating any dependence with RakNet.

Re: build error; file libs/network/src/NetworkUtils.cpp

PostPosted: 02 Aug 2012, 11:58
by Michael
douggiem wrote:I'm now working on extracting parts from raknet and "re-writing" it, thus eliminating any dependence with RakNet.


Sounds great! Perhaps replacing RakNet with a free library e.g.:

http://hawksoft.com/hawknl/ or
http://www.libsdl.org/projects/SDL_net/

would be easier than re-writing some parts.

my 2 cents,
Michael