ssh.h (2834B)
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_SSH_H 21#define GUAC_SSH_H 22 23#include "config.h" 24 25#include "common/clipboard.h" 26#include "common-ssh/sftp.h" 27#include "common-ssh/ssh.h" 28#include "common-ssh/user.h" 29#include "settings.h" 30#include "terminal/terminal.h" 31 32#ifdef ENABLE_SSH_AGENT 33#include "ssh_agent.h" 34#endif 35 36#include <guacamole/client.h> 37#include <guacamole/recording.h> 38 39#include <pthread.h> 40 41/** 42 * SSH-specific client data. 43 */ 44typedef struct guac_ssh_client { 45 46 /** 47 * SSH connection settings. 48 */ 49 guac_ssh_settings* settings; 50 51#ifdef ENABLE_SSH_AGENT 52 /** 53 * The current agent, if any. 54 */ 55 ssh_auth_agent* auth_agent; 56#endif 57 58 /** 59 * The SSH client thread. 60 */ 61 pthread_t client_thread; 62 63 /** 64 * The user and credentials to use for all SSH sessions. 65 */ 66 guac_common_ssh_user* user; 67 68 /** 69 * SSH session, used by the SSH client thread. 70 */ 71 guac_common_ssh_session* session; 72 73 /** 74 * SFTP session, used by the SFTP client/filesystem. 75 */ 76 guac_common_ssh_session* sftp_session; 77 78 /** 79 * The filesystem object exposed for the SFTP session. 80 */ 81 guac_common_ssh_sftp_filesystem* sftp_filesystem; 82 83 /** 84 * SSH terminal channel, used by the SSH client thread. 85 */ 86 LIBSSH2_CHANNEL* term_channel; 87 88 /** 89 * Lock dictating access to the SSH terminal channel. 90 */ 91 pthread_mutex_t term_channel_lock; 92 93 /** 94 * The terminal which will render all output from the SSH client. 95 */ 96 guac_terminal* term; 97 98 /** 99 * The in-progress session recording, or NULL if no recording is in 100 * progress. 101 */ 102 guac_recording* recording; 103 104} guac_ssh_client ; 105 106/** 107 * Main SSH client thread, handling transfer of SSH output to STDOUT. 108 * 109 * @param data 110 * The guac_client to associate with a new SSH session, once the SSH 111 * connection succeeds. 112 * 113 * @return 114 * NULL in all cases. The return value of this thread is expected to be 115 * ignored. 116 */ 117void* ssh_client_thread(void* data); 118 119#endif 120