libssh 0.11.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
26struct ssh_auth_request {
27 char *username;
28 int method;
29 char *password;
30 struct ssh_key_struct *pubkey;
31 struct ssh_key_struct *server_pubkey;
32 char *sigtype;
33 enum ssh_publickey_state_e signature_state;
34 char kbdint_response;
35};
36
37struct ssh_channel_request_open {
38 int type;
39 uint32_t sender;
40 uint32_t window;
41 uint32_t packet_size;
42 char *originator;
43 uint16_t originator_port;
44 char *destination;
45 uint16_t destination_port;
46};
47
48struct ssh_service_request {
49 char *service;
50};
51
52struct ssh_global_request {
53 int type;
54 uint8_t want_reply;
55 char *bind_address;
56 uint16_t bind_port;
57};
58
59struct ssh_channel_request {
60 int type;
61 ssh_channel channel;
62 uint8_t want_reply;
63 /* pty-req type specifics */
64 char *TERM;
65 uint32_t width;
66 uint32_t height;
67 uint32_t pxwidth;
68 uint32_t pxheight;
69 ssh_string modes;
70
71 /* env type request */
72 char *var_name;
73 char *var_value;
74 /* exec type request */
75 char *command;
76 /* subsystem */
77 char *subsystem;
78
79 /* X11 */
80 uint8_t x11_single_connection;
81 char *x11_auth_protocol;
82 char *x11_auth_cookie;
83 uint32_t x11_screen_number;
84};
85
86struct ssh_message_struct {
87 ssh_session session;
88 int type;
89 struct ssh_auth_request auth_request;
90 struct ssh_channel_request_open channel_request_open;
91 struct ssh_channel_request channel_request;
92 struct ssh_service_request service_request;
93 struct ssh_global_request global_request;
94};
95
96#ifdef __cplusplus
97extern "C" {
98#endif
99
100SSH_PACKET_CALLBACK(ssh_packet_channel_open);
101SSH_PACKET_CALLBACK(ssh_packet_global_request);
102
103#ifdef WITH_SERVER
104SSH_PACKET_CALLBACK(ssh_packet_service_request);
105SSH_PACKET_CALLBACK(ssh_packet_userauth_request);
106#endif /* WITH_SERVER */
107
108int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet,
109 const char *request, uint8_t want_reply);
110ssh_message ssh_message_pop_head(ssh_session session);
111
112#ifdef __cplusplus
113}
114#endif
115
116#endif /* MESSAGES_H_ */
#define SSH_PACKET_CALLBACK(name)
This macro declares a packet callback handler.
Definition callbacks.h:599