comparison channel.h @ 941:5daedffd0769

Set tcp priority as follows: if (connecting || ptys || x11) tos = LOWDELAY; else if (tcp_forwards) tos = 0; else tos = BULK; TCP forwards could be either lowdelay or bulk, hence the default priority.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 16 Jul 2014 22:53:32 +0800
parents 4ad38e223ccd
children 0bb16232e7c4
comparison
equal deleted inserted replaced
940:e9dfb6d15193 941:5daedffd0769
27 27
28 #include "includes.h" 28 #include "includes.h"
29 #include "buffer.h" 29 #include "buffer.h"
30 #include "circbuffer.h" 30 #include "circbuffer.h"
31 31
32 /* channel->type values */
33 #define CHANNEL_ID_NONE 0
34 #define CHANNEL_ID_SESSION 1
35 #define CHANNEL_ID_X11 2
36 #define CHANNEL_ID_AGENT 3
37 #define CHANNEL_ID_TCPDIRECT 4
38 #define CHANNEL_ID_TCPFORWARDED 5
39
40 #define SSH_OPEN_ADMINISTRATIVELY_PROHIBITED 1 32 #define SSH_OPEN_ADMINISTRATIVELY_PROHIBITED 1
41 #define SSH_OPEN_CONNECT_FAILED 2 33 #define SSH_OPEN_CONNECT_FAILED 2
42 #define SSH_OPEN_UNKNOWN_CHANNEL_TYPE 3 34 #define SSH_OPEN_UNKNOWN_CHANNEL_TYPE 3
43 #define SSH_OPEN_RESOURCE_SHORTAGE 4 35 #define SSH_OPEN_RESOURCE_SHORTAGE 4
44 36
46 #define SSH_OPEN_IN_PROGRESS 99 38 #define SSH_OPEN_IN_PROGRESS 99
47 39
48 #define CHAN_EXTEND_SIZE 3 /* how many extra slots to add when we need more */ 40 #define CHAN_EXTEND_SIZE 3 /* how many extra slots to add when we need more */
49 41
50 struct ChanType; 42 struct ChanType;
43
44 enum dropbear_channel_prio {
45 DROPBEAR_CHANNEL_PRIO_INTERACTIVE, /* pty shell, x11 */
46 DROPBEAR_CHANNEL_PRIO_UNKNOWABLE, /* tcp - can't know what's being forwarded */
47 DROPBEAR_CHANNEL_PRIO_BULK, /* the rest - probably scp or something */
48 DROPBEAR_CHANNEL_PRIO_EARLY, /* channel is still being set up */
49 };
51 50
52 struct Channel { 51 struct Channel {
53 52
54 unsigned int index; /* the local channel index */ 53 unsigned int index; /* the local channel index */
55 unsigned int remotechan; 54 unsigned int remotechan;
85 84
86 /* Used by client chansession to handle ~ escaping, NULL ignored otherwise */ 85 /* Used by client chansession to handle ~ escaping, NULL ignored otherwise */
87 void (*read_mangler)(struct Channel*, unsigned char* bytes, int *len); 86 void (*read_mangler)(struct Channel*, unsigned char* bytes, int *len);
88 87
89 const struct ChanType* type; 88 const struct ChanType* type;
89
90 enum dropbear_channel_prio prio;
90 }; 91 };
91 92
92 struct ChanType { 93 struct ChanType {
93 94
94 int sepfds; /* Whether this channel has seperate pipes for in/out or not */ 95 int sepfds; /* Whether this channel has seperate pipes for in/out or not */
95 char *name; 96 char *name;
96 int (*inithandler)(struct Channel*); 97 int (*inithandler)(struct Channel*);
97 int (*check_close)(struct Channel*); 98 int (*check_close)(struct Channel*);
98 void (*reqhandler)(struct Channel*); 99 void (*reqhandler)(struct Channel*);
99 void (*closehandler)(struct Channel*); 100 void (*closehandler)(struct Channel*);
100
101 }; 101 };
102 102
103 void chaninitialise(const struct ChanType *chantypes[]); 103 void chaninitialise(const struct ChanType *chantypes[]);
104 void chancleanup(); 104 void chancleanup();
105 void setchannelfds(fd_set *readfd, fd_set *writefd); 105 void setchannelfds(fd_set *readfd, fd_set *writefd);