diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-05 22:43:11 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-05 22:43:11 +0200 |
commit | 2561266c156a1f63ed85fe2865ac607507ae4cef (patch) | |
tree | 9fbc7cf5fb9a045e7bbf70ab07f9b5b4e518a782 /src/fastd.h | |
parent | 5f898aa52f81671cbc54beea19211c8a75e0962f (diff) | |
download | fastd-2561266c156a1f63ed85fe2865ac607507ae4cef.tar fastd-2561266c156a1f63ed85fe2865ac607507ae4cef.zip |
Add status socket to get the current status as JSON
Diffstat (limited to 'src/fastd.h')
-rw-r--r-- | src/fastd.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/fastd.h b/src/fastd.h index 17689cd..6eaf831 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -27,7 +27,7 @@ \file \em fastd main header file defining most data structures - */ +*/ #pragma once @@ -217,6 +217,10 @@ struct fastd_config { fastd_shell_command_t on_verify; /**< The command to execute to check if a connection from an unknown peer should be allowed */ #endif +#ifdef WITH_STATUS_SOCKET + char *status_socket; /**< The path of the status socket */ +#endif + bool daemon; /**< Set to make fastd fork to the background after initialization */ char *pid_file; /**< A filename to write fastd's PID to */ @@ -250,6 +254,10 @@ struct fastd_context { VECTOR(struct pollfd) pollfds; /**< The vector of pollfds for all file descriptors */ #endif +#ifdef WITH_STATUS_SOCKET + int status_fd; /**< The file descriptor of the status socket */ +#endif + bool has_floating; /**< Specifies if any of the configured peers have floating remotes */ uint32_t peer_addr_ht_seed; /**< The hash seed used for peer_addr_ht */ @@ -325,6 +333,23 @@ void fastd_cap_drop(void); void fastd_random_bytes(void *buffer, size_t len, bool secure); +#ifdef WITH_STATUS_SOCKET + +void fastd_status_init(void); +void fastd_status_close(void); +void fastd_status_handle(void); + +#else + +static inline void fastd_status_init(void) { +} + +static inline void fastd_status_close(void) { +} + +#endif + + /** Returns a random number between \a min (inclusively) and \a max (exclusively) */ static inline int fastd_rand(int min, int max) { unsigned int r = (unsigned int)random(); |