nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* source: xio-streams.c */ |
2 | /* Copyright Gerhard Rieger 2008 */ |
||
3 | /* Published under the GNU General Public License V.2, see file COPYING */ |
||
4 | |||
5 | /* this file contains definitions and functions for handling POSIX STREAMS */ |
||
6 | |||
7 | /* with this source file a new experimental approach is being introduced: |
||
8 | normally when adding a new option at least four existing files have to be |
||
9 | adapted; this is similar for new address types. |
||
10 | |||
11 | in the future i would like to have a more automatic assembling of socat from |
||
12 | topic oriented source files. this should make integration and control of |
||
13 | contributions more easy. |
||
14 | |||
15 | all code of a new topic - address and option definitions, open code, option |
||
16 | handing code, ev.parser code, etc. should go into one source file. the |
||
17 | selection of the desired code parts during the compilation is done by |
||
18 | setting cpp defines. |
||
19 | |||
20 | in the same was all public declarations should go in one header (.h) file. |
||
21 | */ |
||
22 | |||
23 | /* do not compile this file directly but include it from other .c files. with |
||
24 | CPP defines you select one part you want to really get included: |
||
25 | |||
26 | ENABLE_OPTIONS: activate the definition of the address option records |
||
27 | ENABLE_APPLYOPTS: C code that applies the address option passed in opt |
||
28 | */ |
||
29 | |||
30 | #ifdef ENABLE_OPTIONS |
||
31 | |||
32 | #ifdef I_POP |
||
33 | const struct optdesc opt_streams_i_pop_all = { "streams-i-pop-all", "pop-all", OPT_STREAMS_I_POP_ALL, GROUP_FD, PH_FD, TYPE_BOOL, OFUNC_STREAMS_I_POP_ALL, 0, 0 }; |
||
34 | #endif |
||
35 | #ifdef I_PUSH |
||
36 | const struct optdesc opt_streams_i_push = { "streams-i-push", "push", OPT_STREAMS_I_PUSH, GROUP_FD, PH_FD, TYPE_STRING, OFUNC_STREAMS_I_PUSH, 0, 0 }; |
||
37 | #endif |
||
38 | |||
39 | #elif defined(ENABLE_APPLYOPT) |
||
40 | |||
41 | #if 0 |
||
42 | void dummy(void) { |
||
43 | if (0) { { ; |
||
44 | #endif |
||
45 | #ifdef I_POP |
||
46 | } else if (opt->desc->func == OFUNC_STREAMS_I_POP_ALL) { |
||
47 | while (Ioctl(fd, I_POP, 0) >= 0) { |
||
48 | Warn2("ioctl(%d, I_POP, 0): %s", fd, strerror(errno)); |
||
49 | } |
||
50 | #endif |
||
51 | #ifdef I_PUSH |
||
52 | } else if (opt->desc->func == OFUNC_STREAMS_I_PUSH) { |
||
53 | if (Ioctl(fd, I_PUSH, opt->value.u_string) < 0) { |
||
54 | Warn3("ioctl(%d, I_PUSH, \"%s\"): %s", |
||
55 | fd, opt->value.u_string, strerror(errno)); |
||
56 | opt->desc = ODESC_ERROR; ++opt; continue; |
||
57 | } |
||
58 | #endif |
||
59 | #if 0 |
||
60 | } } } |
||
61 | #endif |
||
62 | |||
63 | #else /* !defined(ENABLE_APPLYOPT) */ |
||
64 | |||
65 | #include "xiosysincludes.h" |
||
66 | #if WITH_STREAMS /* make this address configure dependend */ |
||
67 | #include "xioopen.h" |
||
68 | |||
69 | #include "xio-fd.h" |
||
70 | #include "xio-socket.h" /* _xioopen_connect() */ |
||
71 | #include "xio-listen.h" |
||
72 | #include "xio-ipapp.h" |
||
73 | #include "xio-openssl.h" |
||
74 | |||
75 | |||
76 | |||
77 | #endif /* WITH_STREAMS */ |
||
78 | |||
79 | #endif /* !defined(ENABLE_OPTIONS) */ |