.TH telnet_init 3 LIBTELNET "" "TELNET Library" .SH NAME \fBtelnet_init\fP - initialize a new TELNET connection processor .SH SYNOPSIS .PP \fB#include \fP .sp .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 );" .SH DESCRIPTION .PP The \fBtelnet_init\fP function initializes a new TELNET connection processor and returns a pointer to the state tracker. The parameter \fItelopts\fP is an array of telnet_telopt_t structures, which defines the list of TELNET options your application supports. This array must include a final entry with all structure element set to 0 to indicate the end of the array. The parameter \fIeh\fP is a pointer to a function to handle all events generated by the TELNET processor. The parameter \fIflags\fP is a set of flags controlling libtelnet's behavior. The paramater \fIuser_data\fP is an opaque pointer that will be passed to the \fIeh\fP function when called. .SH RETURN VALUES .PP The return value is a pointer to the libtelnet state tracker, which must be passed to all other libtelnet functions regarding this connection. If \fBtelnet_init\fP fails for any reason, it will return NULL instead. This value must be passed to \fBtelnet_free\fP after the connection is closed to free resources used internally by libtelnet. .SH SEE ALSO .PP \fBlibtelnet\fR(3), \fBtelnet_free\fR(3)