OpenELP  0.9.2
An Open Source EchoLink® Proxy
openelp.h
Go to the documentation of this file.
1 
52 #ifndef OPENELP_H_
53 #define OPENELP_H_
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 #include <stdint.h>
60 
61 #ifndef _WIN32
62 # include <unistd.h>
63 #endif
64 
65 #ifndef OPENELP_API
66 
67 # define OPENELP_API
68 #endif
69 
71 #define PROXY_PASS_RES_LEN 16
72 
76 enum LOG_LEVEL {
79 
82 
85 
88 
91 };
92 
96 enum LOG_MEDIUM {
99 
102 
105 
108 
111 };
112 
120 struct proxy_conf {
122  char *bind_addr;
123 
126 
129 
132 
135 
137  char *password;
138 
140  char *reg_name;
141 
143  char *reg_comment;
144 
146  char *public_addr;
147 
150 
153 
155  uint16_t port;
156 };
157 
165 struct proxy_handle {
167  void *priv;
168 
170  struct proxy_conf conf;
171 };
172 
180 int OPENELP_API get_nonce(uint32_t *nonce);
181 
191 int OPENELP_API get_password_response(uint32_t nonce, const char *password,
192  uint8_t response[PROXY_PASS_RES_LEN]);
193 
202 int OPENELP_API proxy_authorize_callsign(struct proxy_handle *ph,
203  const char *callsign);
204 
210 void OPENELP_API proxy_close(struct proxy_handle *ph);
211 
217 void OPENELP_API proxy_drop(struct proxy_handle *ph);
218 
224 void OPENELP_API proxy_free(struct proxy_handle *ph);
225 
231 void OPENELP_API proxy_ident(struct proxy_handle *ph);
232 
240 int OPENELP_API proxy_init(struct proxy_handle *ph);
241 
250 int OPENELP_API proxy_load_conf(struct proxy_handle *ph, const char *path);
251 
260 void OPENELP_API proxy_log(struct proxy_handle *ph, enum LOG_LEVEL lvl,
261  const char *fmt, ...);
262 
269 void OPENELP_API proxy_log_level(struct proxy_handle *ph, enum LOG_LEVEL lvl);
270 
280 int OPENELP_API proxy_log_select_medium(struct proxy_handle *ph,
281  enum LOG_MEDIUM medium,
282  const char *target);
283 
291 int OPENELP_API proxy_open(struct proxy_handle *ph);
292 
300 int OPENELP_API proxy_process(struct proxy_handle *ph);
301 
307 void OPENELP_API proxy_shutdown(struct proxy_handle *ph);
308 
316 int OPENELP_API proxy_start(struct proxy_handle *ph);
317 
323 void OPENELP_API proxy_update_registration(struct proxy_handle *ph);
324 
325 #ifdef __cplusplus
326 }
327 #endif
328 
329 #endif /* OPENELP_H_ */
proxy_log_level
void proxy_log_level(struct proxy_handle *ph, enum LOG_LEVEL lvl)
Changes the log message importance threshold.
LOG_MEDIUM_NONE
@ LOG_MEDIUM_NONE
Definition: openelp.h:98
proxy_conf::bind_addr_ext
char * bind_addr_ext
Definition: openelp.h:125
proxy_start
int proxy_start(struct proxy_handle *ph)
Starts the client processing thread(s)
proxy_conf::reg_name
char * reg_name
Definition: openelp.h:140
proxy_conf::connection_timeout
uint32_t connection_timeout
Definition: openelp.h:149
proxy_conf::bind_addr
char * bind_addr
Definition: openelp.h:122
PROXY_PASS_RES_LEN
#define PROXY_PASS_RES_LEN
Definition: openelp.h:71
proxy_conf::password
char * password
Definition: openelp.h:137
proxy_conf
Configuration instance for a proxy_handle.
Definition: openelp.h:120
proxy_conf::calls_denied
char * calls_denied
Definition: openelp.h:134
LOG_LEVEL_FATAL
@ LOG_LEVEL_FATAL
Definition: openelp.h:78
get_nonce
int get_nonce(uint32_t *nonce)
Get a single-use 32-bit number.
LOG_MEDIUM_STDOUT
@ LOG_MEDIUM_STDOUT
Definition: openelp.h:101
proxy_free
void proxy_free(struct proxy_handle *ph)
Frees data allocated by proxy_init.
proxy_conf::reg_comment
char * reg_comment
Definition: openelp.h:143
proxy_conf::calls_allowed
char * calls_allowed
Definition: openelp.h:131
LOG_MEDIUM_SYSLOG
@ LOG_MEDIUM_SYSLOG
Definition: openelp.h:107
proxy_load_conf
int proxy_load_conf(struct proxy_handle *ph, const char *path)
Loads the configuration from the file at the given path.
proxy_conf::port
uint16_t port
Definition: openelp.h:155
proxy_open
int proxy_open(struct proxy_handle *ph)
Opens the proxy for client connections.
proxy_handle::priv
void * priv
Definition: openelp.h:167
LOG_MEDIUM_EVENTLOG
@ LOG_MEDIUM_EVENTLOG
Definition: openelp.h:110
proxy_conf::bind_addr_ext_add
char ** bind_addr_ext_add
Definition: openelp.h:128
proxy_process
int proxy_process(struct proxy_handle *ph)
Blocking call to process new clients.
proxy_log_select_medium
int proxy_log_select_medium(struct proxy_handle *ph, enum LOG_MEDIUM medium, const char *target)
Changes the target logging medium.
proxy_init
int proxy_init(struct proxy_handle *ph)
Initializes the private data in a proxy_handle.
LOG_LEVEL_WARN
@ LOG_LEVEL_WARN
Definition: openelp.h:84
proxy_drop
void proxy_drop(struct proxy_handle *ph)
Drops all currently connected clients from the proxy.
proxy_conf::bind_addr_ext_add_len
uint16_t bind_addr_ext_add_len
Definition: openelp.h:152
LOG_MEDIUM_FILE
@ LOG_MEDIUM_FILE
Definition: openelp.h:104
LOG_LEVEL
LOG_LEVEL
Severity level of log information.
Definition: openelp.h:76
LOG_LEVEL_ERROR
@ LOG_LEVEL_ERROR
Definition: openelp.h:81
proxy_handle::conf
struct proxy_conf conf
Definition: openelp.h:170
proxy_conf::public_addr
char * public_addr
Definition: openelp.h:146
proxy_update_registration
void proxy_update_registration(struct proxy_handle *ph)
Updates the registration status of the proxy instance.
LOG_MEDIUM
LOG_MEDIUM
Logging facilities to write logging events to.
Definition: openelp.h:96
proxy_handle
Represents an instance of an EchoLink proxy.
Definition: openelp.h:165
LOG_LEVEL_DEBUG
@ LOG_LEVEL_DEBUG
Definition: openelp.h:90
proxy_ident
void proxy_ident(struct proxy_handle *ph)
Instructs the proxy to identify itself to the current log medium.
proxy_close
void proxy_close(struct proxy_handle *ph)
Closes the proxy so no more clients can connect.
LOG_LEVEL_INFO
@ LOG_LEVEL_INFO
Definition: openelp.h:87
get_password_response
int get_password_response(uint32_t nonce, const char *password, uint8_t response[PROXY_PASS_RES_LEN])
Gets the expected response for a given nonce and password.
proxy_log
void proxy_log(struct proxy_handle *ph, enum LOG_LEVEL lvl, const char *fmt,...)
Logs the given message to the current medium if lvl is high enough.
proxy_authorize_callsign
int proxy_authorize_callsign(struct proxy_handle *ph, const char *callsign)
Authorizes the given callsign against the proxy's configuration.
proxy_shutdown
void proxy_shutdown(struct proxy_handle *ph)
Gracefully shut down all proxy operations asynchronously.