tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

proto_ext_or.h (937B)


      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-2021, 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 
     32 void ext_or_cmd_free_(ext_or_cmd_t *cmd);
     33 
     34 #endif /* !defined(TOR_PROTO_EXT_OR_H) */