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_ */
char * calls_denied
Definition: openelp.h:134
int proxy_start(struct proxy_handle *ph)
Starts the client processing thread(s)
void proxy_shutdown(struct proxy_handle *ph)
Gracefully shut down all proxy operations asynchronously.
int proxy_authorize_callsign(struct proxy_handle *ph, const char *callsign)
Authorizes the given callsign against the proxy&#39;s configuration.
char ** bind_addr_ext_add
Definition: openelp.h:128
void proxy_log_level(struct proxy_handle *ph, enum LOG_LEVEL lvl)
Changes the log message importance threshold.
#define PROXY_PASS_RES_LEN
Definition: openelp.h:71
Definition: openelp.h:98
void * priv
Definition: openelp.h:167
void proxy_free(struct proxy_handle *ph)
Frees data allocated by proxy_init.
uint16_t port
Definition: openelp.h:155
uint32_t connection_timeout
Definition: openelp.h:149
Definition: openelp.h:78
char * bind_addr
Definition: openelp.h:122
Definition: openelp.h:84
int proxy_load_conf(struct proxy_handle *ph, const char *path)
Loads the configuration from the file at the given path.
Definition: openelp.h:81
int get_nonce(uint32_t *nonce)
Get a single-use 32-bit number.
struct proxy_conf conf
Definition: openelp.h:170
Definition: openelp.h:107
Configuration instance for a proxy_handle.
Definition: openelp.h:120
char * password
Definition: openelp.h:137
Represents an instance of an EchoLink proxy.
Definition: openelp.h:165
Definition: openelp.h:87
int proxy_open(struct proxy_handle *ph)
Opens the proxy for client connections.
int proxy_log_select_medium(struct proxy_handle *ph, enum LOG_MEDIUM medium, const char *target)
Changes the target logging medium.
int proxy_init(struct proxy_handle *ph)
Initializes the private data in a proxy_handle.
Definition: openelp.h:110
char * public_addr
Definition: openelp.h:146
int proxy_process(struct proxy_handle *ph)
Blocking call to process new clients.
void proxy_drop(struct proxy_handle *ph)
Drops all currently connected clients from the proxy.
char * reg_comment
Definition: openelp.h:143
void proxy_update_registration(struct proxy_handle *ph)
Updates the registration status of the proxy instance.
LOG_LEVEL
Severity level of log information.
Definition: openelp.h:76
char * calls_allowed
Definition: openelp.h:131
LOG_MEDIUM
Logging facilities to write logging events to.
Definition: openelp.h:96
void proxy_close(struct proxy_handle *ph)
Closes the proxy so no more clients can connect.
void proxy_ident(struct proxy_handle *ph)
Instructs the proxy to identify itself to the current log medium.
char * bind_addr_ext
Definition: openelp.h:125
uint16_t bind_addr_ext_add_len
Definition: openelp.h:152
Definition: openelp.h:101
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.
char * reg_name
Definition: openelp.h:140
Definition: openelp.h:90
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.
Definition: openelp.h:104