sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
bridgeif.h
Go to the documentation of this file.
1
5
6
/*
7
* Copyright (c) 2017 Simon Goldschmidt.
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without modification,
11
* are permitted provided that the following conditions are met:
12
*
13
* 1. Redistributions of source code must retain the above copyright notice,
14
* this list of conditions and the following disclaimer.
15
* 2. Redistributions in binary form must reproduce the above copyright notice,
16
* this list of conditions and the following disclaimer in the documentation
17
* and/or other materials provided with the distribution.
18
* 3. The name of the author may not be used to endorse or promote products
19
* derived from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30
* OF SUCH DAMAGE.
31
*
32
* This file is part of the lwIP TCP/IP stack.
33
*
34
* Author: Simon Goldschmidt <goldsimon@gmx.de>
35
*
36
*/
37
#ifndef LWIP_HDR_NETIF_BRIDGEIF_H
38
#define LWIP_HDR_NETIF_BRIDGEIF_H
39
40
#include "
netif/bridgeif_opts.h
"
41
42
#include "
lwip/err.h
"
43
#include "
lwip/prot/ethernet.h
"
44
45
#ifdef __cplusplus
46
extern
"C"
{
47
#endif
48
49
struct
netif
;
50
51
#if (BRIDGEIF_MAX_PORTS < 0) || (BRIDGEIF_MAX_PORTS >= 64)
52
#error BRIDGEIF_MAX_PORTS must be [1..63]
53
#elif BRIDGEIF_MAX_PORTS < 8
54
typedef
u8_t bridgeif_portmask_t;
55
#elif BRIDGEIF_MAX_PORTS < 16
56
typedef
u16_t bridgeif_portmask_t;
57
#elif BRIDGEIF_MAX_PORTS < 32
58
typedef
u32_t bridgeif_portmask_t;
59
#elif BRIDGEIF_MAX_PORTS < 64
60
typedef
u64_t bridgeif_portmask_t;
61
#endif
62
63
#define BR_FLOOD ((bridgeif_portmask_t)-1)
64
70
typedef
struct
bridgeif_initdata_s
{
72
struct
eth_addr
ethaddr
;
75
u8_t
max_ports
;
78
u16_t
max_fdb_dynamic_entries
;
80
u16_t
max_fdb_static_entries
;
81
}
bridgeif_initdata_t
;
82
87
#define BRIDGEIF_INITDATA1(max_ports, max_fdb_dynamic_entries, max_fdb_static_entries, ethaddr) {ethaddr, max_ports, max_fdb_dynamic_entries, max_fdb_static_entries}
92
#define BRIDGEIF_INITDATA2(max_ports, max_fdb_dynamic_entries, max_fdb_static_entries, e0, e1, e2, e3, e4, e5) {{e0, e1, e2, e3, e4, e5}, max_ports, max_fdb_dynamic_entries, max_fdb_static_entries}
93
94
err_t bridgeif_init(
struct
netif
*
netif
);
95
err_t bridgeif_add_port(
struct
netif
*bridgeif,
struct
netif
*portif);
96
err_t bridgeif_fdb_add(
struct
netif
*bridgeif,
const
struct
eth_addr
*addr, bridgeif_portmask_t ports);
97
err_t bridgeif_fdb_remove(
struct
netif
*bridgeif,
const
struct
eth_addr
*addr);
98
99
/* FDB interface, can be replaced by own implementation */
100
void
bridgeif_fdb_update_src(
void
*fdb_ptr,
struct
eth_addr
*src_addr, u8_t port_idx);
101
bridgeif_portmask_t bridgeif_fdb_get_dst_ports(
void
*fdb_ptr,
struct
eth_addr
*dst_addr);
102
void
* bridgeif_fdb_init(u16_t max_fdb_entries);
103
104
#if BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
105
#ifndef BRIDGEIF_DECL_PROTECT
106
/* define bridgeif protection to sys_arch_protect... */
107
#include "
lwip/sys.h
"
108
#define BRIDGEIF_DECL_PROTECT(lev) SYS_ARCH_DECL_PROTECT(lev)
109
#define BRIDGEIF_READ_PROTECT(lev) SYS_ARCH_PROTECT(lev)
110
#define BRIDGEIF_READ_UNPROTECT(lev) SYS_ARCH_UNPROTECT(lev)
111
#define BRIDGEIF_WRITE_PROTECT(lev)
112
#define BRIDGEIF_WRITE_UNPROTECT(lev)
113
#endif
114
#else
/* BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT */
115
#include "
lwip/tcpip.h
"
116
#define BRIDGEIF_DECL_PROTECT(lev)
117
#define BRIDGEIF_READ_PROTECT(lev)
118
#define BRIDGEIF_READ_UNPROTECT(lev)
119
#define BRIDGEIF_WRITE_PROTECT(lev)
120
#define BRIDGEIF_WRITE_UNPROTECT(lev)
121
#endif
/* BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT */
122
123
#ifdef __cplusplus
124
}
125
#endif
126
127
#endif
/* LWIP_HDR_NETIF_BRIDGEIF_H */
bridgeif_opts.h
err.h
bridgeif_initdata_t
struct bridgeif_initdata_s bridgeif_initdata_t
ethernet.h
tcpip.h
bridgeif_initdata_s
Definition
bridgeif.h:70
bridgeif_initdata_s::max_ports
u8_t max_ports
Definition
bridgeif.h:75
bridgeif_initdata_s::max_fdb_static_entries
u16_t max_fdb_static_entries
Definition
bridgeif.h:80
bridgeif_initdata_s::ethaddr
struct eth_addr ethaddr
Definition
bridgeif.h:72
bridgeif_initdata_s::max_fdb_dynamic_entries
u16_t max_fdb_dynamic_entries
Definition
bridgeif.h:78
eth_addr
Definition
ethernet.h:61
netif
Definition
tcpip.h:1271
sys.h
core
ps2ip
include
lwip_include
netif
bridgeif.h
Generated by
1.18.0