1str_to_gensio(3) Library Functions Manual str_to_gensio(3)
2
3
4
6 str_to_gensio, str_to_gensio_child, gensio_acc_str_to_gensio - Create a
7 gensio from a string
8
10 #include <gensio/gensio.h>
11
12 int str_to_gensio(const char *str,
13 struct gensio_os_funcs *o,
14 gensio_event cb, void *user_data,
15 struct gensio **io);
16
17 int str_to_gensio_child(struct gensio *child, const char *str,
18 struct gensio_os_funcs *o,
19 gensio_event cb, void *user_data,
20 struct gensio **io);
21
22 int gensio_acc_str_to_gensio(struct gensio_accepter *accepter,
23 const char *str, struct gensio_os_funcs *o,
24 gensio_event cb, void *user_data,
25 struct gensio **io);
26
27 int gensio_terminal_alloc(const char *gensiotype,
28 const void *gdata,
29 const char * const args[],
30 struct gensio_os_funcs *o,
31 gensio_event cb, void *user_data,
32 struct gensio **new_gensio);
33
34 int gensio_filter_alloc(const char *gensiotype,
35 struct gensio *child,
36 const char * const args[],
37 struct gensio_os_funcs *o,
38 gensio_event cb, void *user_data,
39 struct gensio **new_gensio);
40
42 str_to_gensio allocates a new gensio stack based upon the given string
43 str.
44
45 str_to_gensio_child allocates a partial gensio stack and stacks it on
46 top of the given child. Note that if the child is already open, you
47 should use gesnio_open_nochild() to open just this gensio. This can
48 only be used to allocate filter gensios.
49
50 gensio_acc_str_to_gensio allocates a gensio based upon the given ac‐
51 cepter. The availability and use of this varies from gensio to gensio,
52 but it can be used on UDP to create a gensio that uses the UDP ports
53 that the accepter owns. This will come from the first address/port
54 that the accepter is on for TCP and UDP. It will bind to all the ad‐
55 dress/ports for SCTP. To use this, you must specify a string that ex‐
56 actly matches the layers of the accepter. So, for instance, if the ac‐
57 cepter is "telnet,ssl(CA=x1,key=x2,cert=x3),sctp,3095", then the string
58 must be in the form "telnet,ssl(CA=x2),sctp,otherserver,3820" The lay‐
59 ers are exactly the same, but you can vary the options to the layers.
60
61 To directly allocation gensios, you can use gensio_terminal_alloc and
62 gensio_filter_alloc. A terminal gensio is one at the bottom of the
63 stack. The gdata parameter depends on the particular gensio. For in‐
64 stance, for serialdev it is a string specifying the device and serial
65 parameters. For stdio it is an argv array. See gensio.5 under "Direct
66 Allocation" for the particular gensio for what gdata is.
67
68 A filter gensio is one that has a child. You can use these two func‐
69 tions to allocate a gensio stack directly, not using a string format.
70
71 The cb and user_data parameters set a function that will be called when
72 events come in on the gensio. user_data is unused by the gensio stack
73 itself, it is there for the user and may be anything the user wishes.
74 cb may be NULL before the gensio is opened, but must be set before it
75 is opened. In particular, the cb does not need to be set if other gen‐
76 sios will be stacked on top of it in the future, as the gensios stacked
77 on top will set the cb and user_data values.
78
79 The new gensio is returned in io. It will be in the closed state.
80
82 Zero is returned on success, or a gensio error on failure.
83
85 gensio_set_callback(3), gensio_err(3), gensio(5)
86
87
88
89 22 Feb 2019 str_to_gensio(3)