Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
chain.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ChainLink
 Main data structure for CCC nodes. More...
 
struct  DataBuf
 A convenience data structure for passing data chunks between nodes. More...
 

Macros

#define OpStart   1
 
#define OpSend   2
 
#define OpStop   3
 
#define OpEnd   4
 
#define OpAbort   5
 
#define CCC_Stopped   (1 << 0)
 
#define CCC_Ended   (1 << 1)
 
#define CCC_Aborted   (1 << 2)
 
#define FWD   1
 
#define BCK   2
 

Typedefs

typedef struct ChainLink ChainLink
 
typedef void(* ChainFunction_t) (int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2)
 

Functions

ChainLinka_Chain_new (void)
 Create and initialize a new chain-link.
 
ChainLinka_Chain_link_new (ChainLink *AInfo, ChainFunction_t AFunc, int Direction, ChainFunction_t BFunc, int AtoB_branch, int BtoA_branch)
 Create a new link from module A to module B.
 
void a_Chain_unlink (ChainLink *Info, int Direction)
 Unlink a previously used link.
 
int a_Chain_fcb (int Op, ChainLink *Info, void *Data1, void *Data2)
 Issue the forward callback of the 'Info' link.
 
int a_Chain_bcb (int Op, ChainLink *Info, void *Data1, void *Data2)
 Issue the backward callback of the 'Info' link.
 
int a_Chain_bfcb (int Op, ChainLink *Info, void *Data1, void *Data2)
 Issue the backward callback of the 'Info' link and then the forward callback (used for OpAbort and OpStop).
 
int a_Chain_check (char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info)
 Check whether the CCC is operative.
 
DataBufa_Chain_dbuf_new (void *buf, int size, int code)
 Allocate and initialize a new DataBuf structure.
 

Macro Definition Documentation

◆ BCK

#define BCK   2

Definition at line 30 of file chain.h.

◆ CCC_Aborted

#define CCC_Aborted   (1 << 2)

Definition at line 24 of file chain.h.

◆ CCC_Ended

#define CCC_Ended   (1 << 1)

Definition at line 23 of file chain.h.

◆ CCC_Stopped

#define CCC_Stopped   (1 << 0)

Definition at line 22 of file chain.h.

◆ FWD

#define FWD   1

Definition at line 29 of file chain.h.

◆ OpAbort

#define OpAbort   5

Definition at line 17 of file chain.h.

◆ OpEnd

#define OpEnd   4

Definition at line 16 of file chain.h.

◆ OpSend

#define OpSend   2

Definition at line 14 of file chain.h.

◆ OpStart

#define OpStart   1

Definition at line 13 of file chain.h.

◆ OpStop

#define OpStop   3

Definition at line 15 of file chain.h.

Typedef Documentation

◆ ChainFunction_t

typedef void(* ChainFunction_t) (int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2)

Definition at line 33 of file chain.h.

◆ ChainLink

typedef struct ChainLink ChainLink

Definition at line 32 of file chain.h.

Function Documentation

◆ a_Chain_bcb()

int a_Chain_bcb ( int  Op,
ChainLink Info,
void *  Data1,
void *  Data2 
)

Issue the backward callback of the 'Info' link.

Returns
1 if OK, 0 if not operative.

Definition at line 126 of file chain.c.

References ChainLink::Bcb, ChainLink::BcbBranch, ChainLink::BcbInfo, BCK, CCC_Aborted, CCC_Ended, ChainLink::Flags, OpAbort, and OpEnd.

Referenced by a_Capi_ccc(), a_Chain_bfcb(), a_Dpi_ccc(), a_Http_ccc(), Http_connect_tls(), and Http_send_query().

◆ a_Chain_bfcb()

int a_Chain_bfcb ( int  Op,
ChainLink Info,
void *  Data1,
void *  Data2 
)

Issue the backward callback of the 'Info' link and then the forward callback (used for OpAbort and OpStop).

Returns
1 if OK, 0 if not operative.

Definition at line 150 of file chain.c.

References a_Chain_bcb(), a_Chain_fcb(), ChainLink::Flags, OpAbort, and OpEnd.

Referenced by a_Http_ccc(), a_Http_connect_done(), Http_connect_tls(), and Http_dns_cb().

◆ a_Chain_check()

int a_Chain_check ( char *  FuncStr,
int  Op,
int  Branch,
int  Dir,
ChainLink Info 
)

Check whether the CCC is operative.

Also used to hook debug information.

Returns
1 if ready to use, 0 if not operative.

Definition at line 186 of file chain.c.

References CCC_Aborted, CCC_Ended, Chain_debug_msg(), ChainLink::Flags, and MSG_WARN.

Referenced by a_Capi_ccc(), a_Dpi_ccc(), a_Http_ccc(), and a_IO_ccc().

◆ a_Chain_dbuf_new()

DataBuf * a_Chain_dbuf_new ( void *  buf,
int  size,
int  code 
)

Allocate and initialize a new DataBuf structure.

Definition at line 171 of file chain.c.

References DataBuf::Buf, DataBuf::Code, dNew, and DataBuf::Size.

Referenced by a_Capi_dpi_send_data(), a_IO_ccc(), Capi_conn_resume(), Dpi_parse_token(), Http_connect_tls(), and Http_send_query().

◆ a_Chain_fcb()

int a_Chain_fcb ( int  Op,
ChainLink Info,
void *  Data1,
void *  Data2 
)

Issue the forward callback of the 'Info' link.

Returns
1 if OK, 0 if not operative.

Definition at line 103 of file chain.c.

References CCC_Aborted, CCC_Ended, ChainLink::Fcb, ChainLink::FcbBranch, ChainLink::FcbInfo, ChainLink::Flags, FWD, OpAbort, and OpEnd.

Referenced by a_Chain_bfcb(), a_Dpi_ccc(), a_Http_ccc(), a_IO_ccc(), and Dpi_parse_token().

◆ a_Chain_link_new()

ChainLink * a_Chain_link_new ( ChainLink AInfo,
ChainFunction_t  AFunc,
int  Direction,
ChainFunction_t  BFunc,
int  AtoB_branch,
int  BtoA_branch 
)

Create a new link from module A to module B.

Parameters
Directiontells whether to make a forward or backward link.
  • The link from 'A' to 'B' has Direction direction.
  • The main flow of information names the FWD direction.
AtoB_branchbranch on which 'B' receives communications from 'A'
BtoA_branchbranch on which 'A' receives communications from 'B'

Definition at line 55 of file chain.c.

References a_Chain_new(), ChainLink::Bcb, ChainLink::BcbBranch, ChainLink::BcbInfo, BCK, ChainLink::Fcb, ChainLink::FcbBranch, and ChainLink::FcbInfo.

Referenced by a_Capi_ccc(), a_Dpi_ccc(), and a_Http_ccc().

◆ a_Chain_new()

ChainLink * a_Chain_new ( void  )

Create and initialize a new chain-link.

Definition at line 42 of file chain.c.

References dNew0.

Referenced by a_Capi_dpi_send_data(), a_Capi_open_url(), and a_Chain_link_new().

◆ a_Chain_unlink()

void a_Chain_unlink ( ChainLink Info,
int  Direction 
)

Unlink a previously used link.

Parameters
Directiontells whether to unlink the forward or backward link.

Definition at line 86 of file chain.c.

References ChainLink::Bcb, ChainLink::BcbBranch, ChainLink::BcbInfo, ChainLink::Fcb, ChainLink::FcbBranch, ChainLink::FcbInfo, and FWD.