Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, 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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2005
    Posts
    5

    Replacing NIC with own C programs.


    Hi,
    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

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,847
    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/

  3. #3
    Just Joined!
    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •