libssh 0.12.0
The SSH library
Loading...
Searching...
No Matches
messages.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2009 by Aris Adamantiadis
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef MESSAGES_H_
22#define MESSAGES_H_
23
24#include "config.h"
25
26#include <stdint.h>
27
28#include "libssh/callbacks.h"
29#include "libssh/libssh.h"
30
31struct ssh_auth_request {
32 char *username;
33 int method;
34 char *password;
35 struct ssh_key_struct *pubkey;
36 struct ssh_key_struct *server_pubkey;
37 char *sigtype;
38 enum ssh_publickey_state_e signature_state;
39 char kbdint_response;
40};
41
42struct ssh_channel_request_open {
43 int type;
44 uint32_t sender;
45 uint32_t window;
46 uint32_t packet_size;
47 char *originator;
48 uint16_t originator_port;
49 char *destination;
50 uint16_t destination_port;
51};
52
53struct ssh_service_request {
54 char *service;
55};
56
57struct ssh_global_request {
58 int type;
59 uint8_t want_reply;
60 char *bind_address;
61 uint16_t bind_port;
62};
63
64struct ssh_channel_request {
65 int type;
66 ssh_channel channel;
67 uint8_t want_reply;
68 /* pty-req type specifics */
69 char *TERM;
70 uint32_t width;
71 uint32_t height;
72 uint32_t pxwidth;
73 uint32_t pxheight;
74 ssh_string modes;
75
76 /* env type request */
77 char *var_name;
78 char *var_value;
79 /* exec type request */
80 char *command;
81 /* subsystem */
82 char *subsystem;
83
84 /* X11 */
85 uint8_t x11_single_connection;
86 char *x11_auth_protocol;
87 char *x11_auth_cookie;
88 uint32_t x11_screen_number;
89};
90
91struct ssh_message_struct {
92 ssh_session session;
93 int type;
94 struct ssh_auth_request auth_request;
95 struct ssh_channel_request_open channel_request_open;
96 struct ssh_channel_request channel_request;
97 struct ssh_service_request service_request;
98 struct ssh_global_request global_request;
99};
100
101#ifdef __cplusplus
102extern "C" {
103#endif
104
105SSH_PACKET_CALLBACK(ssh_packet_channel_open);
106SSH_PACKET_CALLBACK(ssh_packet_global_request);
107
108#ifdef WITH_SERVER
109SSH_PACKET_CALLBACK(ssh_packet_service_request);
110SSH_PACKET_CALLBACK(ssh_packet_userauth_request);
111#endif /* WITH_SERVER */
112
113int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet,
114 const char *request, uint8_t want_reply);
115ssh_message ssh_message_pop_head(ssh_session session);
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif /* MESSAGES_H_ */
#define SSH_PACKET_CALLBACK(name)
This macro declares a packet callback handler.
Definition callbacks.h:650