diff options
Diffstat (limited to 'usr/src/uts/common/sys/pfmod.h')
-rw-r--r-- | usr/src/uts/common/sys/pfmod.h | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/usr/src/uts/common/sys/pfmod.h b/usr/src/uts/common/sys/pfmod.h index 682f3ec03d..379847e3e6 100644 --- a/usr/src/uts/common/sys/pfmod.h +++ b/usr/src/uts/common/sys/pfmod.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,8 +19,8 @@ * CDDL HEADER END */ /* - * Copyright (c) 1991,1997-1998 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _SYS_PFMOD_H @@ -43,7 +42,7 @@ extern "C" { #define PF_MAXFILTERS 2047 /* max short words for newpacketfilt */ /* - * filter structure for SETF + * filter structure for SETF */ struct packetfilt { uchar_t Pf_Priority; /* priority of filter */ @@ -61,34 +60,34 @@ struct Pf_ext_packetfilt { }; /* - * We now allow specification of up to MAXFILTERS (short) words of a filter - * command list to be applied to incoming packets to determine if - * those packets should be given to a particular open ethernet file. - * Alternatively, PF_MAXFILTERS and Pf_ext_packetfilt structure can be - * used in case even bigger filter command list is needed. + * We now allow specification of up to MAXFILTERS (short) words of a filter + * command list to be applied to incoming packets to determine if + * those packets should be given to a particular open ethernet file. + * Alternatively, PF_MAXFILTERS and Pf_ext_packetfilt structure can be + * used in case even bigger filter command list is needed. * - * In this context, "word" means a short (16-bit) integer. + * In this context, "word" means a short (16-bit) integer. * - * Each open enet file specifies the filter command list via ioctl. - * Each filter command list specifies a sequence of actions that leaves a - * boolean value on the top of an internal stack. Each word of the - * command list specifies an action from the set {PUSHLIT, PUSHZERO, - * PUSHWORD+N} which respectively push the next word of the filter, zero, - * or word N of the incoming packet on the stack, and a binary operator - * from the set {EQ, LT, LE, GT, GE, AND, OR, XOR} which operates on the - * top two elements of the stack and replaces them with its result. The - * special action NOPUSH and the special operator NOP can be used to only - * perform the binary operation or to only push a value on the stack. + * The filter command list is specified using ioctl(). Each filter command + * list specifies a sequence of actions that leaves a boolean value on the + * top of an internal stack. There is also an offset register which is + * initialized to zero. Each word of the command list specifies an action + * from the set {PUSHLIT, PUSHZERO, PUSHWORD+N, LOAD_OFFSET, BRTR, BRFL, POP} + * (see #defines below for definitions), and a binary operator from the set + * {EQ, LT, LE, GT, GE, AND, OR, XOR} which operates on the top two elements + * of the stack and replaces them with its result. The special action NOPUSH + * and the special operator NOP can be used to only perform the binary + * operation or to only push a value on the stack. * - * If the final value of the filter operation is true, then the packet is - * accepted for the open file which specified the filter. + * If the final value of the filter operation is true, then the packet is + * accepted for the open file which specified the filter. */ -/* these must sum to sizeof (ushort_t)! */ +/* these must sum to sizeof (ushort_t)! */ #define ENF_NBPA 10 /* # bits / action */ #define ENF_NBPO 6 /* # bits / operator */ -/* binary operators */ +/* binary operators */ #define ENF_NOP (0 << ENF_NBPA) #define ENF_EQ (1 << ENF_NBPA) #define ENF_LT (2 << ENF_NBPA) @@ -104,14 +103,18 @@ struct Pf_ext_packetfilt { #define ENF_CNAND (12 << ENF_NBPA) #define ENF_NEQ (13 << ENF_NBPA) -/* stack actions */ +/* stack actions */ #define ENF_NOPUSH 0 -#define ENF_PUSHLIT 1 -#define ENF_PUSHZERO 2 -#define ENF_PUSHONE 3 -#define ENF_PUSHFFFF 4 -#define ENF_PUSHFF00 5 -#define ENF_PUSH00FF 6 +#define ENF_PUSHLIT 1 /* Push the next word on the stack */ +#define ENF_PUSHZERO 2 /* Push 0 on the stack */ +#define ENF_PUSHONE 3 /* Push 1 on the stack */ +#define ENF_PUSHFFFF 4 /* Push 0xffff on the stack */ +#define ENF_PUSHFF00 5 /* Push 0xff00 on the stack */ +#define ENF_PUSH00FF 6 /* Push 0x00ff on the stack */ +#define ENF_LOAD_OFFSET 7 /* Load the next word into the offset register */ +#define ENF_BRTR 8 /* Branch if the stack's top element is true */ +#define ENF_BRFL 9 /* Branch if the stack's top element is false */ +#define ENF_POP 10 /* Pop the top element from the stack */ #define ENF_PUSHWORD 16 #ifdef __cplusplus |