OpenELP 0.9.3
An Open Source EchoLink® Proxy
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
openelp.h File Reference

Public API for OpenELP, An Open Source EchoLink® Proxy. More...

#include <stdint.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  proxy_conf
 Configuration instance for a proxy_handle. More...
 
struct  proxy_handle
 Represents an instance of an EchoLink proxy. More...
 

Macros

#define PROXY_PASS_RES_LEN   16
 

Enumerations

enum  LOG_LEVEL {
  LOG_LEVEL_FATAL = 0 , LOG_LEVEL_ERROR , LOG_LEVEL_WARN , LOG_LEVEL_INFO ,
  LOG_LEVEL_DEBUG
}
 Severity level of log information. More...
 
enum  LOG_MEDIUM {
  LOG_MEDIUM_NONE = 0 , LOG_MEDIUM_STDOUT , LOG_MEDIUM_FILE , LOG_MEDIUM_SYSLOG ,
  LOG_MEDIUM_EVENTLOG
}
 Logging facilities to write logging events to. More...
 

Functions

int get_nonce (uint32_t *nonce)
 Get a single-use 32-bit number.
 
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.
 
int proxy_authorize_callsign (struct proxy_handle *ph, const char *callsign)
 Authorizes the given callsign against the proxy's configuration.
 
void proxy_close (struct proxy_handle *ph)
 Closes the proxy so no more clients can connect.
 
void proxy_drop (struct proxy_handle *ph)
 Drops all currently connected clients from the proxy.
 
void proxy_free (struct proxy_handle *ph)
 Frees data allocated by proxy_init.
 
void proxy_ident (struct proxy_handle *ph)
 Instructs the proxy to identify itself to the current log medium.
 
int proxy_init (struct proxy_handle *ph)
 Initializes the private data in a proxy_handle.
 
int proxy_load_conf (struct proxy_handle *ph, const char *path)
 Loads the configuration from the file at the given path.
 
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.
 
void proxy_log_level (struct proxy_handle *ph, enum LOG_LEVEL lvl)
 Changes the log message importance threshold.
 
int proxy_log_select_medium (struct proxy_handle *ph, enum LOG_MEDIUM medium, const char *target)
 Changes the target logging medium.
 
int proxy_open (struct proxy_handle *ph)
 Opens the proxy for client connections.
 
int proxy_process (struct proxy_handle *ph)
 Blocking call to process new clients.
 
void proxy_shutdown (struct proxy_handle *ph)
 Gracefully shut down all proxy operations asynchronously.
 
int proxy_start (struct proxy_handle *ph)
 Starts the client processing thread(s)
 
void proxy_update_registration (struct proxy_handle *ph)
 Updates the registration status of the proxy instance.
 

Detailed Description

Public API for OpenELP, An Open Source EchoLink® Proxy.

Author
Scott K Logan <logan.nosp@m.s@co.nosp@m.ttsay.nosp@m..net>

DESCRIPTION

These definitions, data structures and functions manipulate and operate the proxy.

Macro Definition Documentation

◆ PROXY_PASS_RES_LEN

#define PROXY_PASS_RES_LEN   16

Length in bytes of the expected password response from the client

Enumeration Type Documentation

◆ LOG_LEVEL

enum LOG_LEVEL

Severity level of log information.

Enumerator
LOG_LEVEL_FATAL 

A fatal event, which will result in program termination

LOG_LEVEL_ERROR 

A failure event which should not have happened under normal circumstances

LOG_LEVEL_WARN 

An unusual event which could indicate a problem

LOG_LEVEL_INFO 

An event which is part of the normal lifecycle of the program

LOG_LEVEL_DEBUG 

A verbose event

◆ LOG_MEDIUM

enum LOG_MEDIUM

Logging facilities to write logging events to.

Enumerator
LOG_MEDIUM_NONE 

Discard all log messages

LOG_MEDIUM_STDOUT 

Print all log messages to stdout and stderr

LOG_MEDIUM_FILE 

Append all log messages to the given file

LOG_MEDIUM_SYSLOG 

Send all log messages to Syslog

LOG_MEDIUM_EVENTLOG 

Send all log messages to the Windows Event Log

Function Documentation

◆ get_nonce()

int get_nonce ( uint32_t *  nonce)

Get a single-use 32-bit number.

Parameters
[out]nonceResulting single-use number
Returns
0 on success, negative ERRNO value on failure

◆ 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.

Parameters
[in]nonceSingle use number
[in]passwordNull terminated password string
[out]responseExpected password response
Returns
0 on success, negative ERRNO value on failure

◆ proxy_authorize_callsign()

int proxy_authorize_callsign ( struct proxy_handle ph,
const char *  callsign 
)

Authorizes the given callsign against the proxy's configuration.

Parameters
[in]phTarget proxy instance
[in]callsignNull-terminated string containing the callsign
Returns
1 if call is authorized, 0 if not, negative ERRNO value on failure

◆ proxy_close()

void proxy_close ( struct proxy_handle ph)

Closes the proxy so no more clients can connect.

Parameters
[in,out]phTarget proxy instance

◆ proxy_drop()

void proxy_drop ( struct proxy_handle ph)

Drops all currently connected clients from the proxy.

Parameters
[in,out]phTarget proxy instance

◆ proxy_free()

void proxy_free ( struct proxy_handle ph)

Frees data allocated by proxy_init.

Parameters
[in,out]phTarget proxy instance

◆ proxy_ident()

void proxy_ident ( struct proxy_handle ph)

Instructs the proxy to identify itself to the current log medium.

Parameters
[in]phTarget proxy instance

◆ proxy_init()

int proxy_init ( struct proxy_handle ph)

Initializes the private data in a proxy_handle.

Parameters
[in,out]phTarget proxy instance
Returns
0 on success, negative ERRNO value on failure

◆ proxy_load_conf()

int proxy_load_conf ( struct proxy_handle ph,
const char *  path 
)

Loads the configuration from the file at the given path.

Parameters
[in,out]phTarget proxy instance
[in]pathNull-terminated string containing the path to the file
Returns
0 on success, negative ERRNO value on failure

◆ 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.

Parameters
[in]phTarget proxy instance
[in]lvlMessage's level of importance
[in]fmtString format of message
[in]...Arguments for format specification

◆ proxy_log_level()

void proxy_log_level ( struct proxy_handle ph,
enum LOG_LEVEL  lvl 
)

Changes the log message importance threshold.

Parameters
[in,out]phTarget proxy instance
[in]lvlNew message importance threshold

◆ 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.

Parameters
[in,out]phTarget proxy instance
[in]mediumNew logging medium to use
[in]targetMedium target, where appropriate
Returns
0 on success, negative ERRNO value on failure

◆ proxy_open()

int proxy_open ( struct proxy_handle ph)

Opens the proxy for client connections.

Parameters
[in,out]phTarget proxy instance
Returns
0 on success, negative ERRNO value on failure

◆ proxy_process()

int proxy_process ( struct proxy_handle ph)

Blocking call to process new clients.

Parameters
[in,out]phTarget proxy instance
Returns
0 on success, negative ERRNO value on failure

◆ proxy_shutdown()

void proxy_shutdown ( struct proxy_handle ph)

Gracefully shut down all proxy operations asynchronously.

Parameters
[in,out]phTarget proxy instance

◆ proxy_start()

int proxy_start ( struct proxy_handle ph)

Starts the client processing thread(s)

Parameters
[in,out]phTarget proxy instance
Returns
0 on success, negative ERRNO value on failure

◆ proxy_update_registration()

void proxy_update_registration ( struct proxy_handle ph)

Updates the registration status of the proxy instance.

Parameters
[in]phTarget proxy instance