sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1
6
7
/*
8
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
9
* All rights reserved.
10
*
11
* Redistribution and use in source and binary forms, with or without modification,
12
* are permitted provided that the following conditions are met:
13
*
14
* 1. Redistributions of source code must retain the above copyright notice,
15
* this list of conditions and the following disclaimer.
16
* 2. Redistributions in binary form must reproduce the above copyright notice,
17
* this list of conditions and the following disclaimer in the documentation
18
* and/or other materials provided with the distribution.
19
* 3. The name of the author may not be used to endorse or promote products
20
* derived from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31
* OF SUCH DAMAGE.
32
*
33
* This file is part of the lwIP TCP/IP stack.
34
*
35
* Author: Adam Dunkels <adam@sics.se>
36
*
37
*/
38
#ifndef LWIP_HDR_PROT_ETHERNET_H
39
#define LWIP_HDR_PROT_ETHERNET_H
40
41
#include "
lwip/arch.h
"
42
#include "
lwip/prot/ieee.h
"
43
44
#ifdef __cplusplus
45
extern
"C"
{
46
#endif
47
48
#ifndef ETH_HWADDR_LEN
49
#ifdef ETHARP_HWADDR_LEN
50
#define ETH_HWADDR_LEN ETHARP_HWADDR_LEN
/* compatibility mode */
51
#else
52
#define ETH_HWADDR_LEN 6
53
#endif
54
#endif
55
56
#ifdef PACK_STRUCT_USE_INCLUDES
57
# include "arch/bpstruct.h"
58
#endif
59
PACK_STRUCT_BEGIN
61
struct
eth_addr
{
62
PACK_STRUCT_FLD_8(u8_t addr[ETH_HWADDR_LEN]);
63
} PACK_STRUCT_STRUCT;
64
PACK_STRUCT_END
65
#ifdef PACK_STRUCT_USE_INCLUDES
66
# include "arch/epstruct.h"
67
#endif
68
70
#define ETH_ADDR(b0, b1, b2, b3, b4, b5) {{b0, b1, b2, b3, b4, b5}}
71
72
#ifdef PACK_STRUCT_USE_INCLUDES
73
# include "arch/bpstruct.h"
74
#endif
75
PACK_STRUCT_BEGIN
77
struct
eth_hdr
{
78
#if ETH_PAD_SIZE
79
PACK_STRUCT_FLD_8(u8_t padding[
ETH_PAD_SIZE
]);
80
#endif
81
PACK_STRUCT_FLD_S(
struct
eth_addr
dest);
82
PACK_STRUCT_FLD_S(
struct
eth_addr
src);
83
PACK_STRUCT_FIELD(u16_t type);
84
} PACK_STRUCT_STRUCT;
85
PACK_STRUCT_END
86
#ifdef PACK_STRUCT_USE_INCLUDES
87
# include "arch/epstruct.h"
88
#endif
89
90
#define SIZEOF_ETH_HDR (14 + ETH_PAD_SIZE)
91
92
#ifdef PACK_STRUCT_USE_INCLUDES
93
# include "arch/bpstruct.h"
94
#endif
95
PACK_STRUCT_BEGIN
99
struct
eth_vlan_hdr
{
100
PACK_STRUCT_FIELD(u16_t prio_vid);
101
PACK_STRUCT_FIELD(u16_t tpid);
102
} PACK_STRUCT_STRUCT;
103
PACK_STRUCT_END
104
#ifdef PACK_STRUCT_USE_INCLUDES
105
# include "arch/epstruct.h"
106
#endif
107
108
#define SIZEOF_VLAN_HDR 4
109
#define VLAN_ID(vlan_hdr) (lwip_htons((vlan_hdr)->prio_vid) & 0xFFF)
110
112
#define LL_IP4_MULTICAST_ADDR_0 0x01
113
#define LL_IP4_MULTICAST_ADDR_1 0x00
114
#define LL_IP4_MULTICAST_ADDR_2 0x5e
115
117
#define LL_IP6_MULTICAST_ADDR_0 0x33
118
#define LL_IP6_MULTICAST_ADDR_1 0x33
119
120
/* eth_addr_cmp is deprecated, use eth_addr_eq */
121
#define eth_addr_cmp(addr1, addr2) eth_addr_eq((addr1), (addr2))
122
#define eth_addr_eq(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETH_HWADDR_LEN) == 0)
123
124
#ifdef __cplusplus
125
}
126
#endif
127
128
#endif
/* LWIP_HDR_PROT_ETHERNET_H */
arch.h
ETH_PAD_SIZE
#define ETH_PAD_SIZE
Definition
opt.h:717
ieee.h
eth_addr
Definition
ethernet.h:61
eth_hdr
Definition
ethernet.h:77
eth_vlan_hdr
Definition
ethernet.h:99
core
ps2ip
include
lwip_include
lwip
prot
ethernet.h
Generated by
1.18.0