-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathpipe.h
126 lines (98 loc) · 2.14 KB
/
pipe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* This file is part of the tknet project.
* which be used under the terms of the GNU General Public
* License version 3.0 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file. Please review the following
* information to ensure the GNU General Public License
* version 3.0 requirements will be met:
* http://www.gnu.org/copyleft/gpl.html
*
* Copyright (C) 2012 Zhong Wei <[email protected]> .
*/
#include "tknet.h"
#define PIPE_NAME_MAXLEN 23
//Now, the max len is defined by the
//longest possible name string:
//"123.123.123.123/12345\0"
#define FLOW_PAELSE_NAME_LEN 32
struct pipe;
typedef void (*PipeFlowCallbk)(char* ,uint ,struct pipe*,
void* ,void*);
#define FLOW_CALLBK_FUNCTION( _fun_name ) \
void _fun_name (char* pa_pData,uint pa_DataLen,struct pipe *pa_pPipe, \
void *pa_pFlowPa,void* pa_else)
struct pipe
{
PipeFlowCallbk FlowCallbk;
void *pFlowPa;//freed by pipe.
char name[PIPE_NAME_MAXLEN];
uint id;
struct ListNode ln;
struct Iterator IDirection;
struct Iterator IReference;
};
struct connection
{
struct Iterator *pIterator;
struct connection *pCounterPart;
struct ListNode ln;
};
struct FindPipeByName
{
char *name;
struct pipe *found;
};
struct FindPipeByID
{
uint id;
struct pipe *found;
};
struct PipeMap
{
struct Iterator IPipe;
};
struct FlowCallbkPa
{
char *pData;
uint DataLen;
void *Else;
};
struct FlowPaElse
{
char PaName[FLOW_PAELSE_NAME_LEN];
void *pPa;
};
struct IfPipeToPa
{
struct pipe* pTo;
BOOL res;
};
void
MakeConnection(struct Iterator *,struct Iterator *);
void
CutConnections(struct Iterator *);
BOOL
PipeDirectOnlyTo(struct pipe *,struct pipe *);
BOOL
PipeDirectTo(struct pipe *,struct pipe *);
void
PipeDele(struct pipe *);
struct pipe*
PipeFindByName(char *);
struct pipe*
PipeMap(char *);
void
PipeTablePrint();
void
PipeFlow(struct pipe *,char *,uint ,void *);
void
PipeModuleInit();
void
PipeModuleUninit();
BOOL
ifPipeTo(struct pipe *,struct pipe *);
struct pipe*
PipeFindByID(uint);
void
PipeReset();