1/**
2 * \file
3 * \brief Application registration API
4 *
5 * This file contains definitions for the bfdmux application register.
6 */
7/*
8 * Copyright (c) 2009, 2010, ETH Zurich.
9 * All rights reserved.
10 *
11 * This file is distributed under the terms in the attached LICENSE file.
12 * If you do not find this file, copies can be found by writing to:
13 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
14 */
15
16#ifndef __FILTER_H__
17#define __FILTER_H__
18
19
20#include <stdint.h>
21
22
23/*
24 * Op-Codes
25 */
26
27// Comparision
28#define OP_EQUAL	0x11 /**< \brief Operator == */
29#define OP_SGREATER	0x12 /**< \brief Operator > (signed) */
30#define OP_SLESS	0x13 /**< \brief Operator < (signed) */
31#define OP_UGREATER	0x14 /**< \brief Operator > (unsigned) */
32#define OP_ULESS	0x15 /**< \brief Operator < (unsigned) */
33#define OP_UNEQUAL	0x21 /**< \brief Operator != */
34#define OP_SGREATEREQUAL 0x22 /**< \brief Operator >= (signed) */
35#define OP_SLESSEQUAL	0x23 /**< \brief Operator <= (signed) */
36#define OP_UGREATEREQUAL 0x24 /**< \brief Operator >= (unsigned) */
37#define OP_ULESSEQUAL	0x25 /**< \brief Operator <= (unsigned) */
38
39// Arithmetic
40#define OP_ADD	0x31 /**< \brief Operator + */
41#define OP_SUB	0x32 /**< \brief Operator - */
42#define OP_MULT	0x33 /**< \brief Operator * */
43#define OP_IDIV	0x34 /**< \brief Operator / (integer division) */
44#define OP_MOD	0x35 /**< \brief Operator % */
45
46// Logical
47#define OP_NOT	0x41 /**< \brief Operator ! */
48/**
49 * \brief Operator &&
50 *
51 * Expects an additional 32bit word before the two operands
52 * holding the code size of the first operand subtree in bytes.
53 * This is used to speed up filter execution when the first operand
54 * already determines the result of the operation, e.g. false && something.
55*/
56#define OP_AND	0x42
57/**
58 * \brief Operator ||
59 *
60 * Expects an additional 32bit word before the two operands
61 * holding the code size of the first operand subtree in bytes.
62 * This is used to speed up filter execution when the first operand
63 * already determines the result of the operation, e.g. true || something.
64 */
65#define OP_OR	0x43
66
67// Bitwise
68#define OP_BNOT	0x51 /**< \brief Operator ~ */
69#define OP_BAND	0x52 /**< \brief Operator & */
70#define OP_BOR	0x53 /**< \brief Operator | */
71#define OP_BXOR	0x54 /**< \brief Operator ^ */
72
73// Immediate values
74#define OP_INT8		0x61 /**< \brief 8 bit immediate value, data follows */
75#define OP_INT16	0x62 /**< \brief 16 bit immediate value, data follows */
76#define OP_INT32	0x63 /**< \brief 32 bit immediate value, data follows */
77#define OP_INT64	0x64 /**< \brief 64 bit immediate value, data follows */
78
79// Load data
80#define OP_LOAD8	0x71 /**< \brief 8 bit indirect value, location follows */
81#define OP_LOAD16	0x72 /**< \brief 16 bit indirect value, location follows */
82#define OP_LOAD32	0x73 /**< \brief 32 bit indirect value, location follows */
83#define OP_LOAD64	0x74 /**< \brief 64 bit indirect value, location follows */
84
85
86#endif
87