Results 1 to 3 of 3
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
01-24-2006 #1
- Join Date
- Dec 2005
- Posts
- 5
Replacing NIC with own C programs.
Iam assigned a task to develop a tool which will transfer files from one system to another connected using the ethernet but there wont be any interface card. I hav to write the C programs that will do the tasks of identifying ports n sockets,assigning addresses, appending headers and performs checksums. Right now Iam in complete darkness 'coz I dont know the next step. So plz help me if u hav any idea about this task and where i can get some material or working model. Thx
-
01-24-2006 #2
Well surely, for the sake of a tenner a card, it's easier and better to go buy a couple of nic's and use the regular TCP/IP stack?
Or is this another homework question?Linux user #126863 - see http://linuxcounter.net/
-
01-25-2006 #3
- Join Date
- Apr 2005
- Location
- Romania
- Posts
- 42
To inject your own datagrams, you have to manipulate the headers with the help of:
struct ipheader {
unsigned char ip_hl:4, ip_v:4;
unsigned char ip_tos;
unsigned short int ip_len;
unsigned short int ip_id;
unsigned short int ip_off;
unsigned char ip_ttl;
unsigned char ip_p;
unsigned short int ip_sum;
unsigned int ip_src;
unsigned int ip_dst;
}
or
struct tcpheader {
unsigned short int th_sport;
unsigned short int th_dport;
unsigned int th_seq;
unsigned int th_ack;
unsigned char th_x2:4, th_off:4;
unsigned char th_flags;
unsigned short int th_win;
unsigned short int th_sum;
unsigned short int th_urp;
}
and so on...