The Sequence Toolkit
www.sequence-toolkit.com
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
stk_data_flow_api.h File Reference
#include "stk_env.h"
#include "stk_data_flow.h"
Include dependency graph for stk_data_flow_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

stk_data_flow_tstk_alloc_data_flow (stk_env_t *env, stk_uint16 flow_type, char *name, stk_data_flow_id id, int extendedsz, stk_data_flow_module_t *fptrs, stk_options_t *options)
 
void stk_hold_data_flow (stk_data_flow_t *df)
 
stk_ret stk_free_data_flow (stk_data_flow_t *df)
 
void * stk_data_flow_module_data (stk_data_flow_t *df)
 
int stk_data_flow_errno (stk_data_flow_t *df)
 
void stk_set_data_flow_errno (stk_data_flow_t *df, int newerrno)
 
stk_env_tstk_env_from_data_flow (stk_data_flow_t *df)
 
stk_data_flow_id stk_get_data_flow_id (stk_data_flow_t *df)
 
stk_uint16 stk_get_data_flow_type (stk_data_flow_t *df)
 
char * stk_data_flow_name (stk_data_flow_t *df)
 
stk_ret stk_destroy_data_flow (stk_data_flow_t *df)
 
stk_ret stk_data_flow_send (stk_data_flow_t *df, stk_sequence_t *data_sequence, stk_uint64 flags)
 
stk_sequence_tstk_data_flow_rcv (stk_data_flow_t *df, stk_sequence_t *data_sequence, stk_uint64 flags)
 
stk_ret stk_data_flow_id_ip (stk_data_flow_t *flow, struct sockaddr *data_flow_id, socklen_t addrlen)
 
stk_ret stk_data_flow_id_ip_nw (stk_data_flow_t *df, struct sockaddr_in *data_flow_id, socklen_t addrlen)
 
char * stk_data_flow_protocol (stk_data_flow_t *flow)
 
stk_ret stk_data_flow_buffered (stk_data_flow_t *df)
 
stk_ret stk_data_flow_client_ip (stk_sequence_t *seq, struct sockaddr_in *client_ip, socklen_t *addrlen)
 
stk_ret stk_data_flow_add_client_ip (stk_sequence_t *seq, struct sockaddr_in *client_ip, socklen_t addrlen)
 
stk_ret stk_data_flow_client_protocol (stk_sequence_t *seq, char *protocol_ptr, stk_uint64 *len)
 
stk_ret stk_data_flow_add_client_protocol (stk_sequence_t *seq, char *protocol)
 
stk_data_flow_tstk_data_flow_process_extended_options (stk_env_t *env, stk_options_t *options, char *option_name, stk_create_data_flow_t create_data_flow)
 
void stk_data_flow_parse_protocol_str (stk_protocol_def_t *def, char *str)
 

Detailed Description

The data flow API is an abstraction which other modules implement. However, the APIs in this file are used by implementations to provide a common framework and presentation to other STK modules.

If an STK MODULE doesn't support a capability and the data flow API is called, the API will return STK_NOT_SUPPORTED (or NULL for pointer types)

Function Documentation

stk_data_flow_t* stk_alloc_data_flow ( stk_env_t env,
stk_uint16  flow_type,
char *  name,
stk_data_flow_id  id,
int  extendedsz,
stk_data_flow_module_t fptrs,
stk_options_t options 
)

Allocate a STK Data Flow handle The flow_type is an identifier to differentiate the types of data flow (typically a module type). STK provides types, but applications may use their own as they develop data flow modules. The name and id are application provided identifiers for the data flow. The extendedsz defines how much module specific size should be allocated for this data flow. fptrs is an array of function pointers which implement the data flow.

Returns
A data flow handle
See Also
stk_data_flow_module_data()
stk_ret stk_data_flow_add_client_ip ( stk_sequence_t seq,
struct sockaddr_in *  client_ip,
socklen_t  addrlen 
)

API to add the client IP to a sequence

Returns
STK_SUCCESS if the client IP was added
stk_ret stk_data_flow_add_client_protocol ( stk_sequence_t seq,
char *  protocol 
)

API to add the client protcol to a sequence

Returns
STK_SUCCESS if the client IP was added
stk_ret stk_data_flow_buffered ( stk_data_flow_t df)

Abstract API for data flows to provide an indication whether data is buffered

Returns
STK_SUCCESS if data is buffered
stk_ret stk_data_flow_client_ip ( stk_sequence_t seq,
struct sockaddr_in *  client_ip,
socklen_t *  addrlen 
)

API to get the client IP from a sequence for the data flow it was received on. Note: This API converts to host order

Returns
STK_SUCCESS if the client IP was filled out
stk_ret stk_data_flow_client_protocol ( stk_sequence_t seq,
char *  protocol_ptr,
stk_uint64 len 
)

API to get the client protcol from a sequence for the data flow it was received on.

Returns
STK_SUCCESS if the client IP was filled out
int stk_data_flow_errno ( stk_data_flow_t df)

Get the data flow error code.

Returns
the errno related to this data flow
stk_ret stk_data_flow_id_ip ( stk_data_flow_t flow,
struct sockaddr *  data_flow_id,
socklen_t  addrlen 
)

Abstract API to get the identifying IP on any data flow module based on the function pointers passed to data flow creation.

Returns
Whether the ID was filled out
stk_ret stk_data_flow_id_ip_nw ( stk_data_flow_t df,
struct sockaddr_in *  data_flow_id,
socklen_t  addrlen 
)

Get the identifying IP on any data flow in network order

Returns
Whether the ID was filled out
See Also
stk_data_flow_id_ip
void* stk_data_flow_module_data ( stk_data_flow_t df)

Get the custom module address for extended space allocated as part of stk_alloc_data_flow()

See Also
stk_alloc_data_flow()
Returns
The custom module data space pointer
char* stk_data_flow_name ( stk_data_flow_t df)

Get the data flow name

Returns
A reference pointer to the data flow name
void stk_data_flow_parse_protocol_str ( stk_protocol_def_t def,
char *  str 
)

Utility to help parse protocol strings. [protocol:]<ip|name>[:port] where protocol may be <tcp|udp|rawudp|multicast>

stk_data_flow_t* stk_data_flow_process_extended_options ( stk_env_t env,
stk_options_t options,
char *  option_name,
stk_create_data_flow_t  create_data_flow 
)

Utility to find a data flow option and do all the necessary work for data flow creation and auto create it if needed. Pass in a data flow option name like "monitoring_data_flow" and if that option exists in the set, it is returned. Otherwise, "monitoring_data_flow_options" is search for as parameters to create a data flow using the create_data_flow function

Returns
The data flow that is configured or created
char* stk_data_flow_protocol ( stk_data_flow_t flow)

Abstract API to get the protocol string for any data flow (assuming the module implements this API)

Returns
Protocol string
stk_sequence_t* stk_data_flow_rcv ( stk_data_flow_t df,
stk_sequence_t data_sequence,
stk_uint64  flags 
)

Abstract API to receive data on any data flow module based on the function pointers passed to data flow creation.

Returns
A received sequence or NULL
stk_ret stk_data_flow_send ( stk_data_flow_t df,
stk_sequence_t data_sequence,
stk_uint64  flags 
)

Abstract API to send data on any data flow module based on the function pointers passed to data flow creation.

Returns
Whether the send succeeded
stk_ret stk_destroy_data_flow ( stk_data_flow_t df)

Abstract API to destroy a data flow

Returns
Whether the destruction succeeded
stk_env_t* stk_env_from_data_flow ( stk_data_flow_t df)

Get the STK Environment for a data flow.

Returns
The STK Environment pointer
stk_ret stk_free_data_flow ( stk_data_flow_t df)

Free a STK Data Flow

Returns
Whether the data flow was freed successfully
stk_data_flow_id stk_get_data_flow_id ( stk_data_flow_t df)

Get the data flow ID from a data flow

Returns
The data flow ID
stk_uint16 stk_get_data_flow_type ( stk_data_flow_t df)

Get the data flow type from a data flow

Returns
The data flow type
void stk_hold_data_flow ( stk_data_flow_t df)

Add a hold to the data flow.

This bumps a refcnt. Use stk_free_data_flow() to release the hold

See Also
stk_free_data_flow();
void stk_set_data_flow_errno ( stk_data_flow_t df,
int  newerrno 
)

Set the data flow error code.