Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
chain.c File Reference

Concomitant control chain (CCC). More...

#include "msg.h"
#include "chain.h"
#include "../dlib/dlib.h"
Include dependency graph for chain.c:

Go to the source code of this file.

Macros

#define VERBOSE   0
 

Functions

static void Chain_debug_msg (char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info)
 Show debugging info.
 
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).
 
DataBufa_Chain_dbuf_new (void *buf, int size, int code)
 Allocate and initialize a new DataBuf structure.
 
int a_Chain_check (char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info)
 Check whether the CCC is operative.
 

Detailed Description

Concomitant control chain (CCC).

Theory and code by Jorge Arellano Cid

Definition in file chain.c.

Macro Definition Documentation

◆ VERBOSE

#define VERBOSE   0

Definition at line 20 of file chain.c.

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.

◆ Chain_debug_msg()

static void Chain_debug_msg ( char *  FuncStr,
int  Op,
int  Branch,
int  Dir,
ChainLink Info 
)
static

Show debugging info.

Definition at line 36 of file chain.c.

Referenced by a_Chain_check().