T
Tomás Ó hÉilidhe
(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_mac,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?
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_mac,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?