16a03354eSMatthew Dillon /*
2*4408d548SBill Yuan  * Copyright (c) 2014 - 2018 The DragonFly Project.  All rights reserved.
36a03354eSMatthew Dillon  *
46a03354eSMatthew Dillon  * This code is derived from software contributed to The DragonFly Project
59187b359SBill Yuan  * by Bill Yuan <bycn82@dragonflybsd.org>
66a03354eSMatthew Dillon  *
76a03354eSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
86a03354eSMatthew Dillon  * modification, are permitted provided that the following conditions
96a03354eSMatthew Dillon  * are met:
106a03354eSMatthew Dillon  *
116a03354eSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
126a03354eSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
136a03354eSMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
146a03354eSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
156a03354eSMatthew Dillon  *    the documentation and/or other materials provided with the
166a03354eSMatthew Dillon  *    distribution.
176a03354eSMatthew Dillon  * 3. Neither the name of The DragonFly Project nor the names of its
186a03354eSMatthew Dillon  *    contributors may be used to endorse or promote products derived
196a03354eSMatthew Dillon  *    from this software without specific, prior written permission.
206a03354eSMatthew Dillon  *
216a03354eSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
226a03354eSMatthew Dillon  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
236a03354eSMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
246a03354eSMatthew Dillon  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
256a03354eSMatthew Dillon  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
266a03354eSMatthew Dillon  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
276a03354eSMatthew Dillon  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
286a03354eSMatthew Dillon  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
296a03354eSMatthew Dillon  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
306a03354eSMatthew Dillon  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
316a03354eSMatthew Dillon  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
326a03354eSMatthew Dillon  * SUCH DAMAGE.
336a03354eSMatthew Dillon  */
34c8237cdfSBill Yuan #ifndef _IP_FW3_LAYER2_H
35c8237cdfSBill Yuan #define _IP_FW3_LAYER2_H
366a03354eSMatthew Dillon 
376a03354eSMatthew Dillon #define MODULE_LAYER2_ID	1
386a03354eSMatthew Dillon #define MODULE_LAYER2_NAME	"layer2"
396a03354eSMatthew Dillon 
406a03354eSMatthew Dillon #ifdef _KERNEL
41c8237cdfSBill Yuan 
42c8237cdfSBill Yuan void	check_layer2(int *cmd_ctl, int *cmd_val, struct ip_fw_args **args,
43c8237cdfSBill Yuan 		struct ip_fw **f, ipfw_insn *cmd, uint16_t ip_len);
44c8237cdfSBill Yuan void 	check_mac(int *cmd_ctl, int *cmd_val, struct ip_fw_args **args,
45c8237cdfSBill Yuan 		struct ip_fw **f, ipfw_insn *cmd, uint16_t ip_len);
46c8237cdfSBill Yuan void	check_mac_from(int *cmd_ctl, int *cmd_val, struct ip_fw_args **args,
47c8237cdfSBill Yuan 		struct ip_fw **f, ipfw_insn *cmd, uint16_t ip_len);
48c8237cdfSBill Yuan void	check_mac_from_lookup(int *cmd_ctl, int *cmd_val, struct ip_fw_args **args,
49c8237cdfSBill Yuan 		struct ip_fw **f, ipfw_insn *cmd, uint16_t ip_len);
50c8237cdfSBill Yuan void	check_mac_to(int *cmd_ctl, int *cmd_val, struct ip_fw_args **args,
51c8237cdfSBill Yuan 		struct ip_fw **f, ipfw_insn *cmd, uint16_t ip_len);
52c8237cdfSBill Yuan void	check_mac_to_lookup(int *cmd_ctl, int *cmd_val, struct ip_fw_args **args,
53c8237cdfSBill Yuan 		struct ip_fw **f, ipfw_insn *cmd, uint16_t ip_len);
54c8237cdfSBill Yuan 
556a03354eSMatthew Dillon #endif
566a03354eSMatthew Dillon 
57*4408d548SBill Yuan enum ipfw3_layer2_opcodes {
586a03354eSMatthew Dillon 	O_LAYER2_LAYER2,
596a03354eSMatthew Dillon 	O_LAYER2_MAC,
606a03354eSMatthew Dillon 	O_LAYER2_MAC_TYPE,
61ab88ebe4SBill Yuan         O_LAYER2_MAC_SRC,               /* from with layer2     */
62ab88ebe4SBill Yuan         O_LAYER2_MAC_DST,               /* to   with layer2     */
63ab88ebe4SBill Yuan         O_LAYER2_MAC_SRC_LOOKUP,        /* from table N +layer2 */
64ab88ebe4SBill Yuan         O_LAYER2_MAC_DST_LOOKUP,        /* to   table N +layer2 */
656a03354eSMatthew Dillon };
666a03354eSMatthew Dillon 
676a03354eSMatthew Dillon #endif
68