SolarCapture C Bindings User Guide  SF-115721-CD
Draft 2A
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
predicate.h File Reference

sc_pkt_predicate: Interface for testing properties of packets. More...

Data Structures

struct  sc_pkt_predicate
 A packet predicate object. More...
 

Typedefs

typedef int( sc_pkt_predicate_test_fn )(struct sc_pkt_predicate *, struct sc_packet *)
 A packet predicate test function. It should return 1 (true), or 0 (false).
 

Functions

int sc_pkt_predicate_alloc (struct sc_pkt_predicate **pred_out, int private_bytes)
 Allocate a packet predicate object. More...
 
struct sc_objectsc_pkt_predicate_to_object (struct sc_pkt_predicate *pred)
 Convert a sc_pkt_predicate into a sc_object. More...
 
struct sc_pkt_predicatesc_pkt_predicate_from_object (struct sc_object *obj)
 Convert a sc_object into a sc_pkt_predicate. More...
 

Variables

struct sc_pkt_predicate __attribute__
 

Detailed Description

sc_pkt_predicate: Interface for testing properties of packets.

Function Documentation

int sc_pkt_predicate_alloc ( struct sc_pkt_predicate **  pred_out,
int  private_bytes 
)

Allocate a packet predicate object.

Parameters
pred_outOn success the allocated sc_pkt_predicate object.
private_bytesSize of private memory area wanted.
Returns
0 on success.

Packet predicates are used to test packets against some criteria. The test function should return true (1) or false (0).

If private_bytes is non-zero then pred_private is initialised with a pointer to a region of memory of size private_bytes. The pred_private field may be used by the implementation to hold state.

struct sc_pkt_predicate* sc_pkt_predicate_from_object ( struct sc_object obj)

Convert a sc_object into a sc_pkt_predicate.

Parameters
objAn sc_object instance or NULL
Returns
NULL if obj is NULL otherwise the converted sc_pkt_predicate.
struct sc_object* sc_pkt_predicate_to_object ( struct sc_pkt_predicate pred)

Convert a sc_pkt_predicate into a sc_object.

Parameters
predAn sc_pkt_predicate instance or NULL
Returns
NULL if pred is NULL otherwise the converted sc_object.