source: rtems-libbsd/rtemsbsd/include/machine/rtems-bsd-config.h @ f0aaa04

55-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since f0aaa04 was bc9e939, checked in by Christian Mauderer <Christian.Mauderer@…>, on 08/04/16 at 11:20:04

pf: Add configuration via rc.conf.

  • Property mode set to 100644
File size: 6.6 KB
Line 
1/*
2 * Copyright (c) 2016 Chris Johns <chrisj@rtems.org>.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26/*
27 * Configure the LibBSD software stack.
28 *
29 * Configuration defines:
30 *
31 *  RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE : Memory in bytes for mbufs
32 *  RTEMS_BSD_CONFIG_NET_PF_UNIX            : Packet Filter.
33 *  RTEMS_BSD_CONFIG_NET_IF_LAGG            : Link Aggregetion and Failover.
34 *  RTEMS_BSD_CONFIG_NET_IF_VLAN            : Virtual LAN.
35 *  RTEMS_BSD_CONFIG_SERVICE_TELNETD        : Telnet Protocol (TELNET).
36 *   RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE    : Telnet shell task stack size.
37 *  RTEMS_BSD_CONFIG_SERVICE_FTPD           : File Transfer Protocol (FTP).
38 *  RTEMS_BSD_CONFIG_BSP_CONFIG             : Configure default BSP devices.
39 *  RTEMS_BSD_CONFIG_INIT                   : Configure the LibBSD support.
40 *
41 * Rules for adding to this file:
42 *  1. All user visible defines start with 'RTEMS_BSD_CONFIG_'.
43 *  2. Define an implementation define starting with 'RTEMS_BSD_CFGDECL_'.
44 *  3. Only declare anything in the 'RTEMS_BSD_CONFIG_INIT' section.
45 *  4. Do not use '#ifdef ..' or '#ifndef ..'.
46 *  5. All '#endif' statements need a comment showing the '#if ..' logic.
47 */
48
49#ifndef _RTEMS_BSD_CONFIG_h
50#define _RTEMS_BSD_CONFIG_h
51
52#include <stdbool.h>
53
54/*
55 * Include the Nexus bus.
56 */
57#include <machine/rtems-bsd-nexus-bus.h>
58
59/*
60 * Include the SYSINIT support.
61 */
62#include <machine/rtems-bsd-sysinit.h>
63
64/*
65 * Include the services.
66 */
67#include <machine/rtems-bsd-rc-conf-services.h>
68
69/*
70 * Include the RTEMS BSD support.
71 */
72#include <rtems/bsd/bsd.h>
73
74#ifdef __cplusplus
75extern "C" {
76#endif /* __cplusplus */
77
78/*
79 * BSD Kernel configuration.
80 */
81#if defined(RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE)
82  #define RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUFS_SIZE RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE
83#else
84  #define RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUFS_SIZE RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE_MBUF_DEFAULT
85#endif
86
87/*
88 * BSD Kernel modules.
89 */
90
91/*
92 * Unix packet filter.
93 *  https://www.freebsd.org/doc/handbook/firewalls-pf.html
94 */
95#if defined(RTEMS_BSD_CONFIG_NET_PF_UNIX)
96  #define RTEMS_BSD_CFGDECL_NET_PF_UNIX SYSINIT_NEED_NET_PF_UNIX
97#else
98  #define RTEMS_BSD_CFGDECL_NET_PF_UNIX
99#endif /* RTEMS_BSD_CONFIG_NET_PF_UNIX */
100
101/*
102 * Link Aggregation and Failover.
103 *  https://www.freebsd.org/doc/handbook/network-aggregation.html
104 */
105#if defined(RTEMS_BSD_CONFIG_NET_IF_LAGG)
106  #define RTEMS_BSD_CFGDECL_IF_LAGG SYSINIT_NEED_NET_IF_LAGG
107#else
108  #define RTEMS_BSD_CFGDECL_IF_LAGG
109#endif /* RTEMS_BSD_CONFIG_NET_IF_LAGG */
110
111/*
112 * Virtual LAN
113 *  https://www.freebsd.org/cgi/man.cgi?query=rc.conf then 'network_interfaces'.
114 */
115#if defined(RTEMS_BSD_CONFIG_NET_IF_VLAN)
116  #define RTEMS_BSD_CFGDECL_NET_IF_VLAN SYSINIT_NEED_NET_IF_VLAN
117#else
118  #define RTEMS_BSD_CFGDECL_NET_IF_VLAN
119#endif /* RTEMS_BSD_CONFIG_NET_IF_VLAN */
120
121/*
122 * Firewall PF
123 */
124#if defined(RTEMS_BSD_CONFIG_FIREWALL_PF)
125  #define RTEMS_BSD_CFGDECL_FIREWALL_PF SYSINIT_NEED_FIREWALL_PF
126  #define RTEMS_BSD_CFGDECL_FIREWALL_PF_SERVICE \
127      RTEMS_BSD_RC_CONF_SYSINT(rc_conf_firewall_pf)
128#else
129  #define RTEMS_BSD_CFGDECL_FIREWALL_PF
130  #define RTEMS_BSD_CFGDECL_FIREWALL_PF_SERVICE
131#endif /* RTEMS_BSD_CONFIG_FIREWALL_PF */
132
133#if defined(RTEMS_BSD_CONFIG_FIREWALL_PFLOG)
134  #define RTEMS_BSD_CFGDECL_FIREWALL_PFLOG SYSINIT_NEED_FIREWALL_PFLOG
135#else
136  #define RTEMS_BSD_CFGDECL_FIREWALL_PFLOG
137#endif /* RTEMS_BSD_CONFIG_FIREWALL_PFLOG */
138
139#if defined(RTEMS_BSD_CONFIG_FIREWALL_PFSYNC)
140  #define RTEMS_BSD_CFGDECL_FIREWALL_PFSYNC SYSINIT_NEED_FIREWALL_PFSYNC
141#else
142  #define RTEMS_BSD_CFGDECL_FIREWALL_PFSYNC
143#endif /* RTEMS_BSD_CONFIG_FIREWALL_PFSYNC */
144
145/*
146 * FTPD
147 */
148#if defined(RTEMS_BSD_CONFIG_SERVICE_FTPD)
149  #define RTEMS_BSD_CFGDECL_FTPD RTEMS_BSD_RC_CONF_SYSINT(rc_conf_ftpd)
150#else
151  #define RTEMS_BSD_CFGDECL_FTPD
152#endif /* RTEMS_BSD_CONFIG_SERVICE_FTPD */
153
154/*
155 * Telnetd
156 */
157#if defined(RTEMS_BSD_CONFIG_SERVICE_TELNETD)
158  #if !defined(RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE)
159    #define RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE (8 * 1024)
160  #endif /* RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE */
161  #define RTEMS_BSD_CFGDECL_TELNETD_STACK_SIZE \
162    int rtems_telnetd_stack_size = RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE
163  #define RTEMS_BSD_CFGDECL_TELNETD RTEMS_BSD_RC_CONF_SYSINT(rc_conf_telnetd)
164#else
165  #define RTEMS_BSD_CFGDECL_TELNETD_STACK_SIZE
166  #define RTEMS_BSD_CFGDECL_TELNETD
167#endif /* RTEMS_BSD_CONFIG_SERVICE_TELNETD */
168
169/*
170 * Configure the system.
171 */
172#if defined(RTEMS_BSD_CONFIG_INIT)
173  /*
174   * Configure the domain allocation memory size.
175   */
176  uintptr_t rtems_bsd_allocator_domain_page_mbuf_size = \
177    RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUFS_SIZE;
178
179  /*
180   * If a BSP configuration is requested include the Nexus bus BSP
181   * configuration.
182   */
183  #if defined(RTEMS_BSD_CONFIG_BSP_CONFIG)
184    #include <bsp/nexus-devices.h>
185  #endif /* RTEMS_BSD_CONFIG_BSP_CONFIG */
186
187  /*
188   * Create the networking modules and interfaces.
189   */
190  RTEMS_BSD_CFGDECL_NET_PF_UNIX;
191  RTEMS_BSD_CFGDECL_IF_LAGG;
192  RTEMS_BSD_CFGDECL_NET_IF_VLAN;
193
194  /*
195   * Create the firewall
196   */
197  RTEMS_BSD_CFGDECL_FIREWALL_PF;
198  RTEMS_BSD_CFGDECL_FIREWALL_PF_SERVICE;
199  RTEMS_BSD_CFGDECL_FIREWALL_PFLOG;
200  RTEMS_BSD_CFGDECL_FIREWALL_PFSYNC;
201
202  /*
203   * Create the services.
204   */
205  RTEMS_BSD_CFGDECL_TELNETD;
206  RTEMS_BSD_CFGDECL_TELNETD_STACK_SIZE;
207  RTEMS_BSD_CFGDECL_FTPD;
208#endif /* RTEMS_BSD_CONFIG_INIT */
209
210#ifdef __cplusplus
211}
212#endif /* __cplusplus */
213
214#endif /* _RTEMS_BSD_CONFIG_h */
Note: See TracBrowser for help on using the repository browser.