sftp.h (2353B)
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 21#ifndef _SSH_GUAC_SFTP_H 22#define _SSH_GUAC_SFTP_H 23 24#include "config.h" 25 26#include <guacamole/client.h> 27#include <guacamole/stream.h> 28#include <guacamole/user.h> 29 30/** 31 * Handles an incoming stream from a Guacamole "file" instruction, saving the 32 * contents of that stream to the file having the given name within the 33 * upload directory set by guac_sftp_set_upload_path(). 34 */ 35guac_user_file_handler guac_sftp_file_handler; 36 37/** 38 * Initiates an SFTP file download to the user via the Guacamole "file" 39 * instruction. The download will be automatically monitored and continued 40 * after this function terminates in response to "ack" instructions received by 41 * the client. 42 * 43 * @param client 44 * The client associated with the terminal emulator receiving the file. 45 * 46 * @param filename 47 * The filename of the file to download, relative to the given filesystem. 48 * 49 * @return 50 * The file stream created for the file download, already configured to 51 * properly handle "ack" responses, etc. from the client. 52 */ 53guac_stream* guac_sftp_download_file(guac_client* client, char* filename); 54 55/** 56 * Sets the destination directory for future uploads submitted via Guacamole 57 * "file" instruction. This function has no bearing on the destination 58 * directories of files uploaded with "put" instructions. 59 * 60 * @param client 61 * The client setting the upload path. 62 * 63 * @param path 64 * The path to use for future uploads submitted via "file" instruction. 65 */ 66void guac_sftp_set_upload_path(guac_client* client, char* path); 67 68#endif 69