Extending the support of high precision from 126 bit to 256 bit

54 views
Skip to first unread message

pavan kumar reddy kunditipadugu

unread,
Nov 23, 2014, 4:44:56 AM11/23/14
to ns-3-...@googlegroups.com
Dear all,

As a part of LTE-Security framework implementation in ns-3, I need to handle 256 bit data. 

So, I created two new files "int128*128-256.cc" and "int128*128-256.h" and copied these files in "/ns-allinone-3.19/ns-3.19/src/core/model" folder. Finally I modified the wscript file based on the previous data available for 128 bit.  

Now when I run the script with uint256_t data type, I'm getting the below error-

nitk@nitk:~/ns-allinone-3.19/ns-3.19$ ./waf
Waf: Entering directory `/home/nitk/ns-allinone-3.19/ns-3.19/build'
[ 798/1688] cxx: scratch/lena-x2-handover-measures.cc -> build/scratch/lena-x2-handover-measures.cc.1.o
../scratch/lena-x2-handover-measures.cc:36:3: error: ‘uint256_t’ does not name a type
   uint256_t pav1;
   ^
Waf: Leaving directory `/home/nitk/ns-allinone-3.19/ns-3.19/build'
Build failed
 -> task in 'lena-x2-handover-measures' failed (exit status 1): 
{task 140539917038800: cxx lena-x2-handover-measures.cc -> lena-x2-handover-measures.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-fno-strict-aliasing', '-fwrapv', '-fstack-protector', '-fno-strict-aliasing', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/atk-1.0', '-I/usr/include/cairo', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/pango-1.0', '-I/usr/include/gio-unix-2.0', '-I/usr/include/freetype2', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/harfbuzz', '-I/usr/include/libxml2', '-I/usr/include/python2.7', '-I/usr/include/x86_64-linux-gnu/python2.7', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DNDEBUG', '-D_FORTIFY_SOURCE=2', '../scratch/lena-x2-handover-measures.cc', '-c', '-o', 'scratch/lena-x2-handover-measures.cc.1.o']

Please do needful and suggestions are highly appreciated.

Thanks and Regards,
Pavan Kumar Reddy K

int128x128-256.cc
int128x128-256.h
lena-x2-handover-measures.cc
wscript.txt

Konstantinos

unread,
Nov 23, 2014, 4:12:10 PM11/23/14
to ns-3-...@googlegroups.com
When you change a wscript file you should re-configure your project, ie.

./waf clean
./waf configure (you can add any other specific configuration you use)
./waf

pavan kumar reddy kunditipadugu

unread,
Dec 11, 2014, 4:26:34 AM12/11/14
to ns-3-...@googlegroups.com
Thanks for the reply!!

Actually I forgot to include the below steps in my previous post. Sorry for that!!
Even after following the below steps, I'm getting the same error.

Is it possible to write character (char) data in buffer like "void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data)"  function writes the 32 bit unsigned integer data in buffer and advance the iterator position by four bytes? Are there any alternatives to do the same??

Please help me out.

Tommaso Pecorella

unread,
Dec 11, 2014, 7:22:40 AM12/11/14
to ns-3-...@googlegroups.com
Hi,

please take a look at the Buffer::Iterator documentation:

There are many functions to write "something" into a buffer, so just choose the one suitable for your needs.
About writing a char, this is NOT supported, simply because a "char" is not a native type, exactly like an "int".
A Char may be 1, 2 or 4 bytes long (ASCII char, UTF8, UTF16, UTF32). If you need / want to write a char into a buffer, you have to convert it into a basic type. E.g., write it in a buffer (a uint8_t buffer) and use this:

Hope this helps,

T.

pavan kumar reddy kunditipadugu

unread,
Jan 5, 2015, 5:51:12 AM1/5/15
to ns-3-...@googlegroups.com
Awesome Idea, as it worked for me and a big thanks to you :) 
Reply all
Reply to author
Forward
0 new messages