Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
chain.h
Go to the documentation of this file.
1#ifndef __CHAIN_H__
2#define __CHAIN_H__
3
4/*
5 * Concomitant control chain (CCC)
6 * Theory and code by Jorge Arellano Cid <jcid@dillo.org>
7 */
8
9
10/*
11 * Supported CCC operations
12 */
13#define OpStart 1
14#define OpSend 2
15#define OpStop 3
16#define OpEnd 4
17#define OpAbort 5
18
19/*
20 * CCC flags
21 */
22#define CCC_Stopped (1 << 0)
23#define CCC_Ended (1 << 1)
24#define CCC_Aborted (1 << 2)
25
26/*
27 * Linking direction
28 */
29#define FWD 1
30#define BCK 2
31
32typedef struct ChainLink ChainLink;
33typedef void (*ChainFunction_t)(int Op, int Branch, int Dir, ChainLink *Info,
34 void *Data1, void *Data2);
35
50
52typedef struct {
53 char *Buf;
54 int Size;
55 int Code;
56} DataBuf;
57
58
59
60/*
61 * Function prototypes
62 */
65 int Direction, ChainFunction_t BFunc,
66 int AtoB_branch, int BtoA_branch);
67void a_Chain_unlink(ChainLink *Info, int Direction);
68int a_Chain_fcb(int Op, ChainLink *Info, void *Data1, void *Data2);
69int a_Chain_bcb(int Op, ChainLink *Info, void *Data1, void *Data2);
70int a_Chain_bfcb(int Op, ChainLink *Info, void *Data1, void *Data2);
71int a_Chain_check(char *FuncStr, int Op, int Branch, int Dir,
72 ChainLink *Info);
73
74DataBuf *a_Chain_dbuf_new(void *buf, int size, int code);
75
76#endif /* __CHAIN_H__ */
int a_Chain_bcb(int Op, ChainLink *Info, void *Data1, void *Data2)
Issue the backward callback of the 'Info' link.
Definition chain.c:126
DataBuf * a_Chain_dbuf_new(void *buf, int size, int code)
Allocate and initialize a new DataBuf structure.
Definition chain.c:171
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.
Definition chain.c:55
void a_Chain_unlink(ChainLink *Info, int Direction)
Unlink a previously used link.
Definition chain.c:86
int a_Chain_check(char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info)
Check whether the CCC is operative.
Definition chain.c:186
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 Op...
Definition chain.c:150
void(* ChainFunction_t)(int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2)
Definition chain.h:33
int a_Chain_fcb(int Op, ChainLink *Info, void *Data1, void *Data2)
Issue the forward callback of the 'Info' link.
Definition chain.c:103
ChainLink * a_Chain_new(void)
Create and initialize a new chain-link.
Definition chain.c:42
A convenience data structure for passing data chunks between nodes.
Definition chain.h:52
char * Buf
Definition chain.h:53
int Code
Definition chain.h:55
int Size
Definition chain.h:54