Annotation of src/usr.bin/ssh/opacket.h, Revision 1.11
1.1 markus 1: #ifndef _OPACKET_H
2: /* Written by Markus Friedl. Placed in the public domain. */
3:
4: /* Map old to new API */
5: void ssh_packet_start(struct ssh *, u_char);
6: void ssh_packet_put_char(struct ssh *, int ch);
7: void ssh_packet_put_int(struct ssh *, u_int value);
8: void ssh_packet_put_int64(struct ssh *, u_int64_t value);
9: void ssh_packet_put_bignum2(struct ssh *, BIGNUM * value);
10: void ssh_packet_put_ecpoint(struct ssh *, const EC_GROUP *, const EC_POINT *);
11: void ssh_packet_put_string(struct ssh *, const void *buf, u_int len);
12: void ssh_packet_put_cstring(struct ssh *, const char *str);
13: void ssh_packet_put_raw(struct ssh *, const void *buf, u_int len);
14: void ssh_packet_send(struct ssh *);
15:
16: u_int ssh_packet_get_char(struct ssh *);
17: u_int ssh_packet_get_int(struct ssh *);
18: u_int64_t ssh_packet_get_int64(struct ssh *);
19: void ssh_packet_get_bignum2(struct ssh *, BIGNUM * value);
20: void ssh_packet_get_ecpoint(struct ssh *, const EC_GROUP *, EC_POINT *);
21: void *ssh_packet_get_string(struct ssh *, u_int *length_ptr);
22: char *ssh_packet_get_cstring(struct ssh *, u_int *length_ptr);
23:
24: /* don't allow remaining bytes after the end of the message */
25: #define ssh_packet_check_eom(ssh) \
26: do { \
27: int _len = ssh_packet_remaining(ssh); \
28: if (_len > 0) { \
29: logit("Packet integrity error (%d bytes remaining) at %s:%d", \
30: _len ,__FILE__, __LINE__); \
31: ssh_packet_disconnect(ssh, \
32: "Packet integrity error."); \
33: } \
34: } while (0)
35:
36: /* old API */
37: void packet_close(void);
38: u_int packet_get_char(void);
39: u_int packet_get_int(void);
40: void packet_set_connection(int, int);
41: int packet_read_seqnr(u_int32_t *);
42: int packet_read_poll_seqnr(u_int32_t *);
1.2 djm 43: void packet_process_incoming(const char *buf, u_int len);
1.3 djm 44: void packet_write_wait(void);
45: void packet_write_poll(void);
46: void packet_read_expect(int expected_type);
1.1 markus 47: #define packet_set_timeout(timeout, count) \
48: ssh_packet_set_timeout(active_state, (timeout), (count))
49: #define packet_connection_is_on_socket() \
50: ssh_packet_connection_is_on_socket(active_state)
51: #define packet_set_nonblocking() \
52: ssh_packet_set_nonblocking(active_state)
53: #define packet_get_connection_in() \
54: ssh_packet_get_connection_in(active_state)
55: #define packet_get_connection_out() \
56: ssh_packet_get_connection_out(active_state)
57: #define packet_set_protocol_flags(protocol_flags) \
58: ssh_packet_set_protocol_flags(active_state, (protocol_flags))
59: #define packet_get_protocol_flags() \
60: ssh_packet_get_protocol_flags(active_state)
61: #define packet_start_compression(level) \
62: ssh_packet_start_compression(active_state, (level))
63: #define packet_start(type) \
64: ssh_packet_start(active_state, (type))
65: #define packet_put_char(value) \
66: ssh_packet_put_char(active_state, (value))
67: #define packet_put_int(value) \
68: ssh_packet_put_int(active_state, (value))
69: #define packet_put_int64(value) \
70: ssh_packet_put_int64(active_state, (value))
71: #define packet_put_string( buf, len) \
72: ssh_packet_put_string(active_state, (buf), (len))
73: #define packet_put_cstring(str) \
74: ssh_packet_put_cstring(active_state, (str))
75: #define packet_put_raw(buf, len) \
76: ssh_packet_put_raw(active_state, (buf), (len))
77: #define packet_put_bignum2(value) \
78: ssh_packet_put_bignum2(active_state, (value))
79: #define packet_send() \
80: ssh_packet_send(active_state)
81: #define packet_read() \
82: ssh_packet_read(active_state)
83: #define packet_get_int64() \
84: ssh_packet_get_int64(active_state)
85: #define packet_get_bignum2(value) \
86: ssh_packet_get_bignum2(active_state, (value))
87: #define packet_remaining() \
88: ssh_packet_remaining(active_state)
89: #define packet_get_string(length_ptr) \
90: ssh_packet_get_string(active_state, (length_ptr))
91: #define packet_get_string_ptr(length_ptr) \
92: ssh_packet_get_string_ptr(active_state, (length_ptr))
93: #define packet_get_cstring(length_ptr) \
94: ssh_packet_get_cstring(active_state, (length_ptr))
95: #define packet_send_debug(fmt, args...) \
96: ssh_packet_send_debug(active_state, (fmt), ##args)
97: #define packet_disconnect(fmt, args...) \
98: ssh_packet_disconnect(active_state, (fmt), ##args)
99: #define packet_have_data_to_write() \
100: ssh_packet_have_data_to_write(active_state)
101: #define packet_not_very_much_data_to_write() \
102: ssh_packet_not_very_much_data_to_write(active_state)
103: #define packet_set_interactive(interactive, qos_interactive, qos_bulk) \
104: ssh_packet_set_interactive(active_state, (interactive), (qos_interactive), (qos_bulk))
105: #define packet_is_interactive() \
106: ssh_packet_is_interactive(active_state)
107: #define packet_set_maxsize(s) \
108: ssh_packet_set_maxsize(active_state, (s))
109: #define packet_inc_alive_timeouts() \
110: ssh_packet_inc_alive_timeouts(active_state)
111: #define packet_set_alive_timeouts(ka) \
112: ssh_packet_set_alive_timeouts(active_state, (ka))
113: #define packet_get_maxsize() \
114: ssh_packet_get_maxsize(active_state)
115: #define packet_add_padding(pad) \
116: sshpkt_add_padding(active_state, (pad))
117: #define packet_send_ignore(nbytes) \
118: ssh_packet_send_ignore(active_state, (nbytes))
119: #define packet_set_server() \
120: ssh_packet_set_server(active_state)
121: #define packet_set_authenticated() \
122: ssh_packet_set_authenticated(active_state)
123: #define packet_get_input() \
124: ssh_packet_get_input(active_state)
125: #define packet_get_output() \
126: ssh_packet_get_output(active_state)
127: #define packet_check_eom() \
128: ssh_packet_check_eom(active_state)
129: #define set_newkeys(mode) \
130: ssh_set_newkeys(active_state, (mode))
131: #define packet_get_state(m) \
132: ssh_packet_get_state(active_state, m)
133: #define packet_set_state(m) \
134: ssh_packet_set_state(active_state, m)
135: #define packet_get_raw(lenp) \
136: sshpkt_ptr(active_state, lenp)
137: #define packet_get_ecpoint(c,p) \
138: ssh_packet_get_ecpoint(active_state, c, p)
139: #define packet_put_ecpoint(c,p) \
140: ssh_packet_put_ecpoint(active_state, c, p)
141: #define packet_get_rekey_timeout() \
142: ssh_packet_get_rekey_timeout(active_state)
143: #define packet_set_rekey_limits(x,y) \
144: ssh_packet_set_rekey_limits(active_state, x, y)
145: #define packet_get_bytes(x,y) \
146: ssh_packet_get_bytes(active_state, x, y)
1.9 markus 147: #define packet_set_mux() \
148: ssh_packet_set_mux(active_state)
149: #define packet_get_mux() \
150: ssh_packet_get_mux(active_state)
1.11 ! markus 151: #define packet_clear_keys() \
! 152: ssh_packet_clear_keys(active_state)
1.1 markus 153:
154: #endif /* _OPACKET_H */