2014-05-07 18:32:19 +00:00
|
|
|
/*
|
2016-03-25 19:59:40 +00:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
2014-05-07 18:32:19 +00:00
|
|
|
*
|
2016-03-25 19:59:40 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-05-07 18:32:19 +00:00
|
|
|
*
|
2016-03-25 19:59:40 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2014-05-07 18:32:19 +00:00
|
|
|
*/
|
|
|
|
|
2016-03-15 02:47:36 +00:00
|
|
|
#ifndef GUAC_TELNET_H
|
|
|
|
#define GUAC_TELNET_H
|
2014-05-07 18:32:19 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2016-03-15 02:47:36 +00:00
|
|
|
#include "settings.h"
|
|
|
|
#include "terminal.h"
|
2014-05-07 18:32:19 +00:00
|
|
|
|
2014-06-11 18:09:44 +00:00
|
|
|
#include <libtelnet.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2014-05-07 18:32:19 +00:00
|
|
|
|
2016-03-15 02:47:36 +00:00
|
|
|
/**
|
|
|
|
* Telnet-specific client data.
|
|
|
|
*/
|
|
|
|
typedef struct guac_telnet_client {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Telnet connection settings.
|
|
|
|
*/
|
|
|
|
guac_telnet_settings* settings;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The telnet client thread.
|
|
|
|
*/
|
|
|
|
pthread_t client_thread;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The file descriptor of the socket connected to the telnet server,
|
|
|
|
* or -1 if no connection has been established.
|
|
|
|
*/
|
|
|
|
int socket_fd;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Telnet connection, used by the telnet client thread.
|
|
|
|
*/
|
|
|
|
telnet_t* telnet;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether window size should be sent when the window is resized.
|
|
|
|
*/
|
|
|
|
int naws_enabled;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether all user input should be automatically echoed to the
|
|
|
|
* terminal.
|
|
|
|
*/
|
|
|
|
int echo_enabled;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The terminal which will render all output from the telnet client.
|
|
|
|
*/
|
|
|
|
guac_terminal* term;
|
|
|
|
|
|
|
|
} guac_telnet_client;
|
|
|
|
|
2014-05-07 18:32:19 +00:00
|
|
|
/**
|
|
|
|
* Main telnet client thread, handling transfer of telnet output to STDOUT.
|
|
|
|
*/
|
2014-05-07 21:36:49 +00:00
|
|
|
void* guac_telnet_client_thread(void* data);
|
2014-05-07 18:32:19 +00:00
|
|
|
|
2014-05-07 21:19:17 +00:00
|
|
|
/**
|
|
|
|
* Send a telnet NAWS message indicating the given terminal window dimensions
|
|
|
|
* in characters.
|
|
|
|
*/
|
|
|
|
void guac_telnet_send_naws(telnet_t* telnet, uint16_t width, uint16_t height);
|
|
|
|
|
2014-06-17 01:07:13 +00:00
|
|
|
/**
|
|
|
|
* Sends the given username by setting the remote USER environment variable
|
|
|
|
* using the telnet NEW-ENVIRON option.
|
|
|
|
*/
|
|
|
|
void guac_telnet_send_user(telnet_t* telnet, const char* username);
|
|
|
|
|
2014-05-07 18:32:19 +00:00
|
|
|
#endif
|
|
|
|
|