blob: 274332a142fe895dd2f6a905b2ef212e450a78ae [file] [log] [blame]
Sean Middleditcheccc4a42009-10-24 14:53:12 -07001.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
14The \fBtelnet_init\fP function initializes a new TELNET connection processor
15and returns a pointer to the state tracker.
16
17The parameter \fItelopts\fP is an array of telnet_telopt_t structures, which
18defines the list of TELNET options your application supports. This array must
19include a final entry with all structure element set to 0 to indicate the end
20of the array.
21
22The parameter \fIeh\fP is a pointer to a function to handle all events
23generated by the TELNET processor.
24
25The parameter \fIflags\fP is a set of flags controlling libtelnet's behavior.
26
27The paramater \fIuser_data\fP is an opaque pointer that will be passed to
28the \fIeh\fP function when called.
29
30.SH RETURN VALUES
31.PP
32The return value is a pointer to the libtelnet state tracker, which must be
33passed to all other libtelnet functions regarding this connection. If
34\fBtelnet_init\fP fails for any reason, it will return NULL instead.
35
36This value must be passed to \fBtelnet_free\fP after the connection is closed
37to free resources used internally by libtelnet.
38
39.SH SEE ALSO
40.PP
41\fBlibtelnet\fR(3), \fBtelnet_free\fR(3)