telnet.h (2533B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20#ifndef GUAC_TELNET_H 21#define GUAC_TELNET_H 22 23#include "config.h" 24#include "settings.h" 25#include "terminal/terminal.h" 26 27#include <guacamole/recording.h> 28#include <libtelnet.h> 29 30#include <stdint.h> 31 32/** 33 * Telnet-specific client data. 34 */ 35typedef struct guac_telnet_client { 36 37 /** 38 * Telnet connection settings. 39 */ 40 guac_telnet_settings* settings; 41 42 /** 43 * The telnet client thread. 44 */ 45 pthread_t client_thread; 46 47 /** 48 * The file descriptor of the socket connected to the telnet server, 49 * or -1 if no connection has been established. 50 */ 51 int socket_fd; 52 53 /** 54 * Telnet connection, used by the telnet client thread. 55 */ 56 telnet_t* telnet; 57 58 /** 59 * Whether window size should be sent when the window is resized. 60 */ 61 int naws_enabled; 62 63 /** 64 * Whether all user input should be automatically echoed to the 65 * terminal. 66 */ 67 int echo_enabled; 68 69 /** 70 * The terminal which will render all output from the telnet client. 71 */ 72 guac_terminal* term; 73 74 /** 75 * The in-progress session recording, or NULL if no recording is in 76 * progress. 77 */ 78 guac_recording* recording; 79 80} guac_telnet_client; 81 82/** 83 * Main telnet client thread, handling transfer of telnet output to STDOUT. 84 */ 85void* guac_telnet_client_thread(void* data); 86 87/** 88 * Send a telnet NAWS message indicating the given terminal window dimensions 89 * in characters. 90 */ 91void guac_telnet_send_naws(telnet_t* telnet, uint16_t width, uint16_t height); 92 93/** 94 * Sends the given username by setting the remote USER environment variable 95 * using the telnet NEW-ENVIRON option. 96 */ 97void guac_telnet_send_user(telnet_t* telnet, const char* username); 98 99#endif 100