Tor 0.4.9.1-alpha-dev
alertsock.h
Go to the documentation of this file.
1/* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2021, The Tor Project, Inc. */
4/* See LICENSE for licensing information */
5
6/**
7 * \file alertsock.h
8 *
9 * \brief Header for alertsock.c
10 **/
11
12#ifndef TOR_ALERTSOCK_H
13#define TOR_ALERTSOCK_H
14
15#include "orconfig.h"
16#include "lib/net/nettypes.h"
17#include "lib/cc/torint.h"
18
19/** Helper type used to manage waking up the main thread while it's in
20 * the libevent main loop. Used by the work queue code. */
21typedef struct alert_sockets_t {
22 /* XXXX This structure needs a better name. */
23 /** Socket that the main thread should listen for EV_READ events on.
24 * Note that this socket may be a regular fd on a non-Windows platform.
25 */
27 /** Socket to use when alerting the main thread. */
29 /** Function to alert the main thread */
31 /** Function to make the main thread no longer alerted. */
34
35/* Flags to disable one or more alert_sockets backends. */
36#define ASOCKS_NOEVENTFD2 (1u<<0)
37#define ASOCKS_NOEVENTFD (1u<<1)
38#define ASOCKS_NOPIPE2 (1u<<2)
39#define ASOCKS_NOPIPE (1u<<3)
40#define ASOCKS_NOSOCKETPAIR (1u<<4)
41
42int alert_sockets_create(alert_sockets_t *socks_out, uint32_t flags);
44
45#endif /* !defined(TOR_ALERTSOCK_H) */
int alert_sockets_create(alert_sockets_t *socks_out, uint32_t flags)
Definition: alertsock.c:191
void alert_sockets_close(alert_sockets_t *socks)
Definition: alertsock.c:283
Declarations for types used throughout the Tor networking system.
#define tor_socket_t
Definition: nettypes.h:36
int(* alert_fn)(tor_socket_t write_fd)
Definition: alertsock.h:30
tor_socket_t read_fd
Definition: alertsock.h:26
tor_socket_t write_fd
Definition: alertsock.h:28
int(* drain_fn)(tor_socket_t read_fd)
Definition: alertsock.h:32
Integer definitions used throughout Tor.