First off the "Legal stuff", i.e. Limitations and Disclaimers!!!!
At the time of writing this document, the ported implementation was not fully regress tested to make sure it performs exactly the same as the original Linux version. However, the minimal testing done did not reveal any differences in performance and/or functionality between the two ports.
The Linux version is written in C++, so please take note that the writer is not a C++ expert and hence (possibly) some of the suggestions made could be amateurish. Certainly with rigorous testing and more time on the project such possible technical errors could have been spotted and fixed (hopefully).
3.1 Software Environment
The following table shows the software used during the porting.
3.2 Make Utility Issues
From the start, if you get errors when running make using the provided Makefile, simply switch to gmake.
3.2.1 Compiler Isuues
184.108.40.206 Array Indexing Issues
The Linux version indexes arrays using char type. This causes at least warnings during compile time.
Suggested solution: Typecast all indices to unsigned char.
Reason: It appears that the ISO standard does allow/specify that type char can be used as an array index, however, leave it up to the compiler implementors to decided where such char is signed or unsigned. However, a char can either be unsigned or signed. In the case of signed char, this also includes negative numbers that cannot index array and hence a possible runtime error. So some compilers do insist/expect (at complie time) that the char index variable be qualified as either signed or unsigned.
220.127.116.11 Class Variables Initilisation
Ensure that class variables are initialised. Otherwise, calls to some system calls simply fail. E.g. the call to sysctl() function failed until all variables used in its call were properly initialised.
18.104.22.168 Errors and Warnings in File BoBorder.h
Error: “ISO ++ standard ambiguity”.
Suggested solution: At every occurance of an expression where an addition between an object and an integeris performed, use the dot operator+.
E.g. use now.operator+(cAdPeriod) instead of now + cAdPeriod.
22.214.171.124 Errors and Warnings in File LnDiscover.h
Error: “ISO ++ standard ambiguity”.
Suggested solution: At every occurance of an expression where an object is added to an integer, use the dor operator.
E.g. use pruneTime.operator+(cPrunePeriod) instead of pruneTime + cPrunePeriod.
126.96.36.199 Errors accessing member variables of rtentry structure in File MmRouter.h
Error: Variables rt_dst, rt_gateway, rt_genmask and rt_metric are not members of the structure rtentry.
Suggested solution: Comment them out and carry on. At least this stops the compiler errors.
NOTE: Please remember that I didn’t do regress testing and hence didn’t notice any errors as a result of commenting out this code. I however do realise that these commented lines are functional code and one could/should expect some issues either functional or performance related.
188.8.131.52 Errors in Parameter Arguments in File UtDebug.c
Error: Some functions make variable assignments on the function parameters. This causes an error as the same assignments are already made in file UtDebug.h.
Suggested Solution: Comment out the variable assignment part of the function parameters.
184.108.40.206 Changes in File UtInterface.h
This file presented me with so many functional runtime problems that I had to “rewrite” a part of it. This mainly apply to Discover() method.
a) Replace all ioctl function calls with sysctl calls. Search the man pages for the sysctl documentation.
b) The Discover() method mainly extracts each interface’s information from the kernel, create an interface object using the extracted information and then pushes the interface object into a list. Replace the extraction of interface information code and a good reference is the source code of ifconfig.c (that’s part of the FreeBSD distribution).
220.127.116.11 Errors in Parameter Arguments in File UtString.C
Error: Some functions make variable assignments on the function parameters. This causes an error since the same assignments are already made in file UtString.h.
Suggested Solution: Comment out the assignment part of the function parameters.