libssh 0.9.5 The SSH library

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