summaryrefslogtreecommitdiff
path: root/net/netdev.c
blob: 3acd7a41079163b7230ab337f64e10271278641e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdint.h>
#include "inet.h"
#include "eth.h"
#include "netdev.h"
#include "lib/string/string.h"

void netdev_transmit(struct netdev *dev, struct eth_hdr *hdr, uint16_t ethertype, int len, unsigned char *dst)
{
    hdr->ethertype = htons(ethertype);
    memcpy(hdr->smac, dev->hwaddr, 6);
    memcpy(hdr->dmac, dst, 6);

    len += sizeof(struct eth_hdr);

    dev->transmit(hdr,len);
}