473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

What's the most raw networking library?


(I have posted this separately to comp.lang.c++ and comp.lang.c,
reason being that I'd like a response from both communities, but I
haven't cross-posted it because I think it's best not to mix C and C++
discussion)

I want to get into doing some network programming. I'd like to find a
good cross-platform networking library, but failing that, I'd settle
for something that'll work on Linux. I don't mind whether the libary
is C or whether it's C++, I'll work with either.

I don't want the library to be so raw as that I have to calculate my
own Frame Check Sequence for the frames I send, but I would like a
great deal of control, e.g. I'd like to be able to model a frame that
has a particular destination, a particular source, a particular
protocol value. And within the actual frame data, I'd like to be able
to specify whatever I want, any stream of 1's and 0's. For instance,
I'd like to model my own ARP request frame.

The machines I'll be working with will all satisfy the following
criteria:
1) CHAR_BIT == 8
2) I can specify to the compiler not to put padding between
structure members

OK so let's say I want to send an ARP request. I'd like to put
together an ARP header as follows:

typedef struct ARPHeader {
uint8 hardware_type[2],
proto_type[2],
hardware_len,
proto_len,
op[2],
src_MAC[6],
src_IP[4],
dest_MAC[6],
dest_IP[4]
} ARPHeader;
I'd then make an ARPHeader object and populate it:

ARPHeader arph = { /* blah blah blah */ };

And then I'd like to send the data out as a frame, e.g. something
like:

void LibraryFunctionForSendingFrame(uint8 dest[6],
uint8 src[6],
unsigned data_len,
uint8 const *data);

LibraryFunctionForSendingFrame(broadcast_addr,my_m ac,sizeof
arph,arph);

Is there any kind of networking library that gives me this kind of
maticulous control? Also, I want to be able to listen to the NIC to
see if I get an ARP response.

And just for kicks, is there any kind of networking library that will
give you even *greater* control than this, e.g. one that will let you
specify a dodgy frame length and a dodgy Frame Check Sequence?
Feb 27 '08 #1
3 2199
On Feb 27, 11:57 am, "Tomás Ó hÉilidhe" <t...@lavabit.comwrote:
(I have posted this separately to comp.lang.c++ and comp.lang.c,
reason being that I'd like a response from both communities, but I
haven't cross-posted it because I think it's best not to mix C and C++
discussion)

I want to get into doing some network programming. I'd like to find a
good cross-platform networking library, but failing that, I'd settle
for something that'll work on Linux. I don't mind whether the libary
is C or whether it's C++, I'll work with either.

I don't want the library to be so raw as that I have to calculate my
own Frame Check Sequence for the frames I send, but I would like a
great deal of control, e.g. I'd like to be able to model a frame that
has a particular destination, a particular source, a particular
protocol value. And within the actual frame data, I'd like to be able
to specify whatever I want, any stream of 1's and 0's. For instance,
I'd like to model my own ARP request frame.

The machines I'll be working with will all satisfy the following
criteria:
1) CHAR_BIT == 8
2) I can specify to the compiler not to put padding between
structure members

OK so let's say I want to send an ARP request. I'd like to put
together an ARP header as follows:

typedef struct ARPHeader {
uint8 hardware_type[2],
proto_type[2],
hardware_len,
proto_len,
op[2],
src_MAC[6],
src_IP[4],
dest_MAC[6],
dest_IP[4]
} ARPHeader;

I'd then make an ARPHeader object and populate it:

ARPHeader arph = { /* blah blah blah */ };

And then I'd like to send the data out as a frame, e.g. something
like:

void LibraryFunctionForSendingFrame(uint8 dest[6],
uint8 src[6],
unsigned data_len,
uint8 const *data);

LibraryFunctionForSendingFrame(broadcast_addr,my_m ac,sizeof
arph,arph);

Is there any kind of networking library that gives me this kind of
maticulous control? Also, I want to be able to listen to the NIC to
see if I get an ARP response.

And just for kicks, is there any kind of networking library that will
give you even *greater* control than this, e.g. one that will let you
specify a dodgy frame length and a dodgy Frame Check Sequence?

How about you ask in one of the 10+ newsgroups dedicated to network
programming?!
Or are you looking for another excuse to advertise your silly proposal
for the 'lets talk about every c++ library in existance' ng here
again?
Feb 27 '08 #2
On Feb 27, 12:57 pm, "Tomás Ó hÉilidhe" <t...@lavabit.comwrote:
[snip]
You can do everything that you described in your post using just BSD
sockets with SOCK_RAW types (on Windows you'd have to enumerate
protocols to find the one you want, but once you create the socket the
API is roughly the same)... see the man page:

http://swoolley.org/man.cgi/7/raw

The data structures for common frame packet headers are in many system
include files already.

See Beej's guide to network programming, and the WinSock FAQ it links
to, to get a handle on cross-platformness:

http://beej.us/guide/bgnet/

Start with those. That's about all the help you'll get here...

On Feb 27, 1:32 pm, Christopher <cp...@austin.rr.comwrote:
How about you ask in one of the 10+ newsgroups dedicated to network
programming?!
Jason
Feb 27 '08 #3
On 2008-02-27 18:57, Tomás Ó hÉilidhe wrote:
(I have posted this separately to comp.lang.c++ and comp.lang.c,
reason being that I'd like a response from both communities, but I
haven't cross-posted it because I think it's best not to mix C and C++
discussion)

I want to get into doing some network programming. I'd like to find a
good cross-platform networking library, but failing that, I'd settle
for something that'll work on Linux. I don't mind whether the libary
is C or whether it's C++, I'll work with either.
Perhaps BSD sockets is what you are looking for, I think they are part
of the POSIX specification which makes then available on many platforms.
They are also quite low-level and allows for using raw sockets.

--
Erik Wikström
Feb 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: James Egan | last post by:
I've seen some networking toolkits for C++, but was wondering if there were (or plans for) a standard set of networking classes for C++? Also, can someone tell me where I can find a...
7
by: Brian Keogh | last post by:
Hi, I'm a student learning TCP/IP networking at University. Although I understand all about TCP/IP Networking in Java I am expected to understand the basics of C with regard to these programs as...
46
by: H.A. Sujith | last post by:
Why doesn't the standard library provide (at least basic) networking facilities using TCP/IP ?
86
by: Randy Yates | last post by:
In Harbison and Steele's text (fourth edition, p.111) it is stated, The C language does not specify the range of integers that the integral types will represent, except ot say that type int may...
9
by: aaronfude | last post by:
Hi, I'm an experienced C++ programmer (mostly in unix and other abstract environments such as mex). I'm now getting into Windows programming and finding out that there are many acronyms and...
9
by: John Salerno | last post by:
There is an article on oreilly.net's OnLamp site called "The World's Most Maintainable Programming Language" (http://www.oreillynet.com/onlamp/blog/2006/03/the_worlds_most_maintainable_p.html). ...
2
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
(I have posted this separately to comp.lang.c++ and comp.lang.c, reason being that I'd like a response from both communities, but I haven't cross-posted it because I think it's best not to mix C...
11
by: Nezhate | last post by:
Hi There ! After learning C++, I must learn gtk mm, libxml, eclipse, TCP/IP . From what should I start? Thanks !!
5
by: disappearedng | last post by:
Hi guys, I am planning to write a web crawler in standard C. I can't seem to find standard libraries provided by C that deals with networks and regular expression. Anyone here knows a good engine...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.