Sean Middleditch | eccc4a4 | 2009-10-24 14:53:12 -0700 | [diff] [blame] | 1 | .TH telnet_init 3 LIBTELNET "" "TELNET Library" |
| 2 | |
| 3 | .SH NAME |
| 4 | \fBtelnet_init\fP - initialize a new TELNET connection processor |
| 5 | |
| 6 | .SH SYNOPSIS |
| 7 | .PP |
| 8 | \fB#include <libtelnet.h>\fP |
| 9 | .sp |
| 10 | .B "telnet_t *telnet_init( const telnet_telopt_t *\fItelopts\fP, telnet_event_handler_t \fIeh\fP, unsigned char \fIflags\fP, void *\fIuser_data\fP );" |
| 11 | |
| 12 | .SH DESCRIPTION |
| 13 | .PP |
| 14 | The \fBtelnet_init\fP function initializes a new TELNET connection processor |
| 15 | and returns a pointer to the state tracker. |
| 16 | |
| 17 | The parameter \fItelopts\fP is an array of telnet_telopt_t structures, which |
| 18 | defines the list of TELNET options your application supports. This array must |
| 19 | include a final entry with all structure element set to 0 to indicate the end |
| 20 | of the array. |
| 21 | |
| 22 | The parameter \fIeh\fP is a pointer to a function to handle all events |
| 23 | generated by the TELNET processor. |
| 24 | |
| 25 | The parameter \fIflags\fP is a set of flags controlling libtelnet's behavior. |
| 26 | |
| 27 | The paramater \fIuser_data\fP is an opaque pointer that will be passed to |
| 28 | the \fIeh\fP function when called. |
| 29 | |
| 30 | .SH RETURN VALUES |
| 31 | .PP |
| 32 | The return value is a pointer to the libtelnet state tracker, which must be |
| 33 | passed to all other libtelnet functions regarding this connection. If |
| 34 | \fBtelnet_init\fP fails for any reason, it will return NULL instead. |
| 35 | |
| 36 | This value must be passed to \fBtelnet_free\fP after the connection is closed |
| 37 | to free resources used internally by libtelnet. |
| 38 | |
| 39 | .SH SEE ALSO |
| 40 | .PP |
| 41 | \fBlibtelnet\fR(3), \fBtelnet_free\fR(3) |