Tor  0.4.6.0-alpha-dev
proto_ext_or.h
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2020, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * @file proto_ext_or.h
9  * @brief Header for proto_ext_or.c
10  **/
11 
12 #ifndef TOR_PROTO_EXT_OR_H
13 #define TOR_PROTO_EXT_OR_H
14 
15 struct buf_t;
16 
17 /** A parsed Extended ORPort message. */
18 struct ext_or_cmd_t {
19  uint16_t cmd; /** Command type */
20  uint16_t len; /** Body length */
21  char body[FLEXIBLE_ARRAY_MEMBER]; /** Message body */
22 };
23 
24 int fetch_ext_or_command_from_buf(struct buf_t *buf,
25  struct ext_or_cmd_t **out);
26 
27 ext_or_cmd_t *ext_or_cmd_new(uint16_t len);
28 
29 #define ext_or_cmd_free(cmd) \
30  FREE_AND_NULL(ext_or_cmd_t, ext_or_cmd_free_, (cmd))
31 
33 
34 #endif /* !defined(TOR_PROTO_EXT_OR_H) */
ext_or_cmd_new
ext_or_cmd_t * ext_or_cmd_new(uint16_t len)
Definition: ext_orport.c:36
fetch_ext_or_command_from_buf
int fetch_ext_or_command_from_buf(struct buf_t *buf, struct ext_or_cmd_t **out)
Definition: proto_ext_or.c:27
ext_or_cmd_t::body
char body[FLEXIBLE_ARRAY_MEMBER]
Definition: proto_ext_or.h:21
ext_or_cmd_free_
void ext_or_cmd_free_(ext_or_cmd_t *cmd)
Definition: ext_orport.c:46
ext_or_cmd_t
Definition: proto_ext_or.h:18
ext_or_cmd_t::len
uint16_t len
Definition: proto_ext_or.h:20