2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
30 uint8_t reservered[3];
31 } __attribute__((packed));
36 uint16_t client_to_server;
41 /* Returns 0 on success, This function is called from an
42 arbitrary thread before any other function in this struct
44 int (*dpi_init)(uint32_t thread_count, int argc, const char *argv[]);
45 /* Return the size that should be allocated in the flow
46 table. It is the sizeof(*flow_data) passed to
48 size_t (*dpi_get_flow_entry_size)(void);
49 /* Called before the flow entry is expired. */
50 void (*dpi_flow_expire)(void *flow_data);
51 /* start function called from a DPI thread itself. The opaque
52 pointer returned here will be passed to dpi_thread_stop and
54 void *(*dpi_thread_start)(void);
55 /* Stop function called from a DPI thread itself. */
56 void (*dpi_thread_stop)(void *opaque);
57 /* Processing function to perform actual DPI work. struct
58 flow_info contains the 5 tuple, flow_data is the entry in
59 the flow table which has a size specified by
60 dpi_get_flow_entry_size(). The payload (together with the
61 time and the direction) is passed through the payload
62 parameter. DPI results are returned by the results
63 array. The function returns 0 on success. */
64 int (*dpi_process)(void *opaque, struct flow_info *fi, void *flow_data,
65 struct dpi_payload *payload, uint32_t results[],
67 /* Called once at cleanup. */
68 void (*dpi_finish)(void);
69 /* Function used for printing. */
70 int (*dpi_print)(const char *fmt, ...);
73 /* Returns the implementation of a dpi_engine. */
74 struct dpi_engine *get_dpi_engine(void);