mikroSDK Reference Manual
ethernet_misc.h
Go to the documentation of this file.
1
31#ifndef _ETHERNET_MISC_H
32#define _ETHERNET_MISC_H
33
34//Dependencies
35#include "core/net.h"
36#include "core/ethernet.h"
37
38//C++ guard
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43//Ethernet related constants
44extern const uint8_t ethPadding[64];
45
46//Ethernet related functions
47error_t ethPadFrame(NetBuffer *buffer, size_t *length);
48
49error_t ethEncodeVlanTag(NetBuffer *buffer, size_t *offset, uint16_t vlanId,
50 int8_t vlanPcp, int8_t vlanDei, uint16_t type);
51
52error_t ethDecodeVlanTag(const uint8_t *frame, size_t length, uint16_t *vlanId,
53 uint16_t *type);
54
55error_t ethCheckDestAddr(NetInterface *interface, const MacAddr *macAddr);
56bool_t ethTrapIgmpPacket(EthHeader *header, uint8_t *data, size_t length);
57
58void ethUpdateInStats(NetInterface *interface, const MacAddr *destMacAddr);
59
60void ethUpdateOutStats(NetInterface *interface, const MacAddr *destMacAddr,
61 size_t length);
62
63void ethUpdateErrorStats(NetInterface *interface, error_t error);
64
65uint32_t ethCalcCrc(const void *data, size_t length);
66uint32_t ethCalcCrcEx(const NetBuffer *buffer, size_t offset, size_t length);
67
68error_t ethCheckCrc(NetInterface *interface, const uint8_t *frame,
69 size_t length);
70
71//C++ guard
72#ifdef __cplusplus
73}
74#endif
75
76#endif
error_t
Error codes.
Definition error.h:43
Ethernet.
TCP/IP stack core.
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89