Changeset 87e5658c in mainline for uspace/srv/ethip/std.h


Ignore:
Timestamp:
2012-02-27T00:03:26Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
962f03b
Parents:
081971b
Message:

Prototype ARP responder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ethip/std.h

    r081971b r87e5658c  
    4040#include <sys/types.h>
    4141
     42#define ETH_ADDR_SIZE 6
     43#define IPV4_ADDR_SIZE 4
     44#define ETH_FRAME_MIN_SIZE 60
     45
    4246/** Ethernet frame header */
    4347typedef struct {
    4448        /** Destination Address */
    45         uint8_t dest[6];
     49        uint8_t dest[ETH_ADDR_SIZE];
    4650        /** Source Address */
    47         uint8_t src[6];
     51        uint8_t src[ETH_ADDR_SIZE];
    4852        /** Ethertype or Length */
    4953        uint16_t etype_len;
    5054} eth_header_t;
    5155
     56/** ARP packet format (for 48-bit MAC addresses and IPv4) */
     57typedef struct {
     58        /** Hardware address space */
     59        uint16_t hw_addr_space;
     60        /** Protocol address space */
     61        uint16_t proto_addr_space;
     62        /** Hardware address size */
     63        uint8_t hw_addr_size;
     64        /** Protocol address size */
     65        uint8_t proto_addr_size;
     66        /** Opcode */
     67        uint16_t opcode;
     68        /** Sender hardware address */
     69        uint8_t sender_hw_addr[ETH_ADDR_SIZE];
     70        /** Sender protocol address */
     71        uint32_t sender_proto_addr;
     72        /** Target hardware address */
     73        uint8_t target_hw_addr[ETH_ADDR_SIZE];
     74        /** Target protocol address */
     75        uint32_t target_proto_addr;
     76} __attribute__((packed)) arp_eth_packet_fmt_t;
     77
     78enum arp_opcode_fmt {
     79        AOP_REQUEST = 1,
     80        AOP_REPLY   = 2
     81};
     82
     83enum arp_hw_addr_space {
     84        AHRD_ETHERNET = 1
     85};
     86
    5287/** IP Ethertype */
    53 #define ETYPE_IP        0x0800
     88enum ether_type {
     89        ETYPE_ARP = 0x0806,
     90        ETYPE_IP  = 0x0800
     91};
    5492
    55 #define ETH_FRAME_MIN_SIZE 60
    5693
    5794#endif
Note: See TracChangeset for help on using the changeset viewer.