diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-14 20:48:59 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-14 20:48:59 +0000 |
commit | 943f6b879d4c525c0b87c62d7cd3caa2916896a9 (patch) | |
tree | 2b34378f0a47d89598b41b610afdfbe6643fad16 /include | |
parent | bc8a8e4c642f07e8c5bf6adcf5a47d3073ff50b6 (diff) |
Remove the old stub files, preferring the optional_api method.
(closes issue #17475)
Reported by: tilghman
Review: https://reviewboard.asterisk.org/r/695/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@276490 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/adsi.h | 132 | ||||
-rw-r--r-- | include/asterisk/agi.h | 5 | ||||
-rw-r--r-- | include/asterisk/crypto.h | 27 | ||||
-rw-r--r-- | include/asterisk/optional_api.h | 11 |
4 files changed, 90 insertions, 85 deletions
diff --git a/include/asterisk/adsi.h b/include/asterisk/adsi.h index 3c31574a5..c4ffedda1 100644 --- a/include/asterisk/adsi.h +++ b/include/asterisk/adsi.h @@ -24,6 +24,8 @@ #define _ASTERISK_ADSI_H #include "asterisk/callerid.h" +#include "asterisk/optional_api.h" + /*! \name ADSI parameters */ /*@{ */ @@ -121,44 +123,35 @@ /*@} */ -/*! Perform Asterisk ADSI initialization (for channel drivers that want - * to support ADSI when the handset is first lifted) - * \param chan Channel to initialize for ADSI (if supported) - * - * \retval 0 on success (or adsi unavailable. - * \retval -1 on hangup. - */ -extern int (*ast_adsi_channel_init)(struct ast_channel *chan); +AST_OPTIONAL_API(int, ast_adsi_begin_download, (struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version), { return 0; }); -extern int (*ast_adsi_begin_download)(struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version); +AST_OPTIONAL_API(int, ast_adsi_end_download, (struct ast_channel *chan), { return 0; }); -extern int (*ast_adsi_end_download)(struct ast_channel *chan); - -/*! Restore ADSI initialization (for applications that play with ADSI - * and want to restore it to normal. If you touch "INFO" then you - * have to use the ast_adsi_channel_init again instead. +/*! Restore ADSI initialization (for applications that play with ADSI + * and want to restore it to normal. If you touch "INFO" then you + * have to use the ast_adsi_channel_init again instead. * \param chan Channel to restore * * \retval 0 on success (or adsi unavailable) * \retval -1 on hangup */ -extern int (*ast_adsi_channel_restore)(struct ast_channel *chan); +AST_OPTIONAL_API(int, ast_adsi_channel_restore, (struct ast_channel *chan), { return 0; }); -/*! - * \brief Display some stuff on the screen +/*! + * \brief Display some stuff on the screen * \param chan Channel to display on * \param lines NULL-terminated list of things to print (no more than 4 recommended) * \param align list of alignments to use (ADSI_JUST_LEFT, ADSI_JUST_RIGHT, ADSI_JUST_CEN, etc..) * \param voice whether to jump into voice mode when finished * - * \retval 0 on success (or adsi unavailable) + * \retval 0 on success (or adsi unavailable) * \retval -1 on hangup */ -extern int (*ast_adsi_print)(struct ast_channel *chan, char **lines, int *align, int voice); +AST_OPTIONAL_API(int, ast_adsi_print, (struct ast_channel *chan, char **lines, int *align, int voice), { return 0; }); -/*! +/*! * \brief Check if scripts for a given app are already loaded. - * Version may be -1, if any version is okay, or 0-255 for a specific version. + * Version may be -1, if any version is okay, or 0-255 for a specific version. * \param chan Channel to test for loaded app * \param app Four character app name (must be unique to your application) * \param ver optional version number @@ -168,22 +161,21 @@ extern int (*ast_adsi_print)(struct ast_channel *chan, char **lines, int *align, * \retval -1 on hangup * \retval 1 if script already loaded. */ -extern int (*ast_adsi_load_session)(struct ast_channel *chan, unsigned char *app, int ver, int data); -extern int (*ast_adsi_unload_session)(struct ast_channel *chan); +AST_OPTIONAL_API(int, ast_adsi_load_session, (struct ast_channel *chan, unsigned char *app, int ver, int data), { return 0; }); +AST_OPTIONAL_API(int, ast_adsi_unload_session, (struct ast_channel *chan), { return 0; }); /* ADSI Layer 2 transmission functions */ -extern int (*ast_adsi_transmit_messages)(struct ast_channel *chan, unsigned char **msg, int *msglen, int *msgtype); -extern int (*ast_adsi_transmit_message)(struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype); -extern int (*ast_adsi_transmit_message_full)(struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait); -/*! Read some encoded DTMF data. +AST_OPTIONAL_API(int, ast_adsi_transmit_message, (struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype), { return 0; }); +AST_OPTIONAL_API(int, ast_adsi_transmit_message_full, (struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait), { return 0; }); +/*! Read some encoded DTMF data. * Returns number of bytes received */ -extern int (*ast_adsi_read_encoded_dtmf)(struct ast_channel *chan, unsigned char *buf, int maxlen); +AST_OPTIONAL_API(int, ast_adsi_read_encoded_dtmf, (struct ast_channel *chan, unsigned char *buf, int maxlen), { return 0; }); /* ADSI Layer 3 creation functions */ -/*! - * \brief Connects an ADSI Display Session +/*! + * \brief Connects an ADSI Display Session * \param buf Character buffer to create parameter in (must have at least 256 free) * \param fdn Optional 4 byte Feature Download Number (for loading soft keys) * \param ver Optional version number (0-255, or -1 to omit) @@ -192,25 +184,25 @@ extern int (*ast_adsi_read_encoded_dtmf)(struct ast_channel *chan, unsigned char * \retval -1 on error. */ -extern int (*ast_adsi_connect_session)(unsigned char *buf, unsigned char *fdn, int ver); +AST_OPTIONAL_API(int, ast_adsi_connect_session, (unsigned char *buf, unsigned char *fdn, int ver), { return 0; }); -/*! Build Query CPE ID of equipment. +/*! Build Query CPE ID of equipment. * Returns number of bytes added to message */ -extern int (*ast_adsi_query_cpeid)(unsigned char *buf); -extern int (*ast_adsi_query_cpeinfo)(unsigned char *buf); +AST_OPTIONAL_API(int, ast_adsi_query_cpeid, (unsigned char *buf), { return 0; }); +AST_OPTIONAL_API(int, ast_adsi_query_cpeinfo, (unsigned char *buf), { return 0; }); -/*! Get CPE ID from an attached ADSI compatible CPE. +/*! Get CPE ID from an attached ADSI compatible CPE. * Returns 1 on success, storing 4 bytes of CPE ID at buf * or -1 on hangup, or 0 if there was no hangup but it failed to find the * device ID. Returns to voice mode if "voice" is non-zero. */ -extern int (*ast_adsi_get_cpeid)(struct ast_channel *chan, unsigned char *cpeid, int voice); +AST_OPTIONAL_API(int, ast_adsi_get_cpeid, (struct ast_channel *chan, unsigned char *cpeid, int voice), { return 0; }); -extern int (*ast_adsi_get_cpeinfo)(struct ast_channel *chan, int *width, int *height, int *buttons, int voice); +AST_OPTIONAL_API(int, ast_adsi_get_cpeinfo, (struct ast_channel *chan, int *width, int *height, int *buttons, int voice), { return 0; }); -/*! - * \brief Begin an ADSI script download +/*! + * \brief Begin an ADSI script download * \param buf Character buffer to create parameter in (must have at least 256 free) * \param service a 1-18 byte name of the feature * \param fdn 4 byte Feature Download Number (for loading soft keys) @@ -221,38 +213,38 @@ extern int (*ast_adsi_get_cpeinfo)(struct ast_channel *chan, int *width, int *he * \retval -1 on error. */ -extern int (*ast_adsi_download_connect)(unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver); +AST_OPTIONAL_API(int, ast_adsi_download_connect, (unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver), { return 0; }); -/*! +/*! * \brief Disconnects a running session. * \param buf Character buffer to create parameter in (must have at least 256 free) * * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_disconnect_session)(unsigned char *buf); +AST_OPTIONAL_API(int, ast_adsi_disconnect_session, (unsigned char *buf), { return 0; }); -/*! - * \brief Disconnects (and hopefully saves) a downloaded script +/*! + * \brief Disconnects (and hopefully saves) a downloaded script * \param buf Character buffer to create parameter in (must have at least 256 free) * * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_download_disconnect)(unsigned char *buf); +AST_OPTIONAL_API(int, ast_adsi_download_disconnect, (unsigned char *buf), { return 0; }); -/*! +/*! * \brief Puts CPE in data mode. * \param buf Character buffer to create parameter in (must have at least 256 free) * * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_data_mode)(unsigned char *buf); -extern int (*ast_adsi_clear_soft_keys)(unsigned char *buf); -extern int (*ast_adsi_clear_screen)(unsigned char *buf); +AST_OPTIONAL_API(int, ast_adsi_data_mode, (unsigned char *buf), { return 0; }); +AST_OPTIONAL_API(int, ast_adsi_clear_soft_keys, (unsigned char *buf), { return 0; }); +AST_OPTIONAL_API(int, ast_adsi_clear_screen, (unsigned char *buf), { return 0; }); -/*! +/*! * \brief Puts CPE in voice mode. * \param buf Character buffer to create parameter in (must have at least 256 free) * \param when (a time in seconds) to make the switch @@ -260,15 +252,15 @@ extern int (*ast_adsi_clear_screen)(unsigned char *buf); * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_voice_mode)(unsigned char *buf, int when); +AST_OPTIONAL_API(int, ast_adsi_voice_mode, (unsigned char *buf, int when), { return 0; }); -/*! - * \brief Returns non-zero if Channel does or might support ADSI +/*! + * \brief Returns non-zero if Channel does or might support ADSI * \param chan Channel to check */ -extern int (*ast_adsi_available)(struct ast_channel *chan); +AST_OPTIONAL_API(int, ast_adsi_available, (struct ast_channel *chan), { return 0; }); -/*! +/*! * \brief Loads a line of info into the display. * \param buf Character buffer to create parameter in (must have at least 256 free) * \param page Page to load (ADSI_COMM_PAGE or ADSI_INFO_PAGE) @@ -282,10 +274,10 @@ extern int (*ast_adsi_available)(struct ast_channel *chan); * \retval -1 on error. */ -extern int (*ast_adsi_display)(unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2); +AST_OPTIONAL_API(int, ast_adsi_display, (unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2), { return 0; }); -/*! - * \brief Sets the current line and page. +/*! + * \brief Sets the current line and page. * \param buf Character buffer to create parameter in (must have at least 256 free) * \param page Which page (ADSI_COMM_PAGE or ADSI_INFO_PAGE) * \param line Line number (1-33 for info page, 1-4 for comm page) @@ -294,9 +286,9 @@ extern int (*ast_adsi_display)(unsigned char *buf, int page, int line, int just, * \retval -1 on error. */ -extern int (*ast_adsi_set_line)(unsigned char *buf, int page, int line); +AST_OPTIONAL_API(int, ast_adsi_set_line, (unsigned char *buf, int page, int line), { return 0; }); -/*! +/*! * \brief Creates "load soft key" parameters * \param buf Character buffer to create parameter in (must have at least 256 free) * \param key Key code from 2 to 33, for which key we are loading @@ -308,10 +300,10 @@ extern int (*ast_adsi_set_line)(unsigned char *buf, int page, int line); * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_load_soft_key)(unsigned char *buf, int key, const char *llabel, const char *slabel, char *ret, int data); +AST_OPTIONAL_API(int, ast_adsi_load_soft_key, (unsigned char *buf, int key, const char *llabel, const char *slabel, char *ret, int data), { return 0; }); -/*! - * \brief Set which soft keys should be displayed +/*! + * \brief Set which soft keys should be displayed * \param buf Character buffer to create parameter in (must have at least 256 free) * \param keys Array of 8 unsigned chars with the key numbers, may be OR'd with ADSI_KEY_HILITE * But remember, the last two keys aren't real keys, they're for scrolling @@ -319,10 +311,10 @@ extern int (*ast_adsi_load_soft_key)(unsigned char *buf, int key, const char *ll * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_set_keys)(unsigned char *buf, unsigned char *keys); +AST_OPTIONAL_API(int, ast_adsi_set_keys, (unsigned char *buf, unsigned char *keys), { return 0; }); -/*! - * \brief Set input information +/*! + * \brief Set input information * \param buf Character buffer to create parameter in (must have at least 256 free) * \param page Which page to input on (ADSI_COMM_PAGE or ADSI_INFO_PAGE) * \param line Line number to input on @@ -333,10 +325,10 @@ extern int (*ast_adsi_set_keys)(unsigned char *buf, unsigned char *keys); * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_input_control)(unsigned char *buf, int page, int line, int display, int format, int just); +AST_OPTIONAL_API(int, ast_adsi_input_control, (unsigned char *buf, int page, int line, int display, int format, int just), { return 0; }); -/*! - * \brief Set input format +/*! + * \brief Set input format * \param buf Character buffer to create parameter in (must have at least 256 free) * \param num Which format we are setting * \param dir Which direction (ADSI_DIR_FROM_LEFT or ADSI_DIR_FROM_RIGHT) @@ -347,7 +339,7 @@ extern int (*ast_adsi_input_control)(unsigned char *buf, int page, int line, int * \retval number of bytes added to buffer * \retval -1 on error. */ -extern int (*ast_adsi_input_format)(unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2); +AST_OPTIONAL_API(int, ast_adsi_input_format, (unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2), { return 0; }); #endif /* _ASTERISK_ADSI_H */ diff --git a/include/asterisk/agi.h b/include/asterisk/agi.h index 210b895ad..329521aeb 100644 --- a/include/asterisk/agi.h +++ b/include/asterisk/agi.h @@ -69,8 +69,9 @@ typedef struct agi_command { * * \param mod Pointer to the module_info structure for the module that is registering the command * \param cmd Pointer to the descriptor for the command - * \return 1 on success, 0 if the command is already registered - * + * \retval 1 on success + * \retval 0 the command is already registered + * \retval AST_OPTIONAL_API_UNAVAILABLE the module is not loaded. */ AST_OPTIONAL_API(int, ast_agi_register, (struct ast_module *mod, agi_command *cmd), diff --git a/include/asterisk/crypto.h b/include/asterisk/crypto.h index 01a61d099..c84728618 100644 --- a/include/asterisk/crypto.h +++ b/include/asterisk/crypto.h @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2010, Digium, Inc. * * Mark Spencer <markster@digium.com> * @@ -27,12 +27,14 @@ extern "C" { #endif +#include "asterisk/optional_api.h" + #define AST_KEY_PUBLIC (1 << 0) #define AST_KEY_PRIVATE (1 << 1) struct ast_key; -/*! +/*! * \brief Retrieve a key * \param name of the key we are retrieving * \param int type of key (AST_KEY_PUBLIC or AST_KEY_PRIVATE) @@ -40,9 +42,9 @@ struct ast_key; * \retval the key on success. * \retval NULL on failure. */ -extern struct ast_key *(*ast_key_get)(const char *key, int type); +AST_OPTIONAL_API(struct ast_key *, ast_key_get, (const char *key, int type), { return NULL; }); -/*! +/*! * \brief Check the authenticity of a message signature using a given public key * \param key a public key to use to verify * \param msg the message that has been signed @@ -52,9 +54,9 @@ extern struct ast_key *(*ast_key_get)(const char *key, int type); * \retval -1 otherwise. * */ -extern int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig); +AST_OPTIONAL_API(int, ast_check_signature, (struct ast_key *key, const char *msg, const char *sig), { return -1; }); -/*! +/*! * \brief Check the authenticity of a message signature using a given public key * \param key a public key to use to verify * \param msg the message that has been signed @@ -64,7 +66,7 @@ extern int (*ast_check_signature)(struct ast_key *key, const char *msg, const ch * \retval -1 otherwise. * */ -extern int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig); +AST_OPTIONAL_API(int, ast_check_signature_bin, (struct ast_key *key, const char *msg, int msglen, const unsigned char *sig), { return -1; }); /*! * \brief Sign a message signature using a given private key @@ -77,7 +79,7 @@ extern int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int * \retval -1 on failure. * */ -extern int (*ast_sign)(struct ast_key *key, char *msg, char *sig); +AST_OPTIONAL_API(int, ast_sign, (struct ast_key *key, char *msg, char *sig), { return -1; }); /*! * \brief Sign a message signature using a given private key @@ -90,7 +92,7 @@ extern int (*ast_sign)(struct ast_key *key, char *msg, char *sig); * \retval -1 on failure. * */ -extern int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig); +AST_OPTIONAL_API(int, ast_sign_bin, (struct ast_key *key, const char *msg, int msglen, unsigned char *sig), { return -1; }); /*! * \brief Encrypt a message using a given private key @@ -104,7 +106,7 @@ extern int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, uns * \retval -1 on failure. * */ -extern int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key); +AST_OPTIONAL_API(int, ast_encrypt_bin, (unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key), { return -1; }); /*! * \brief Decrypt a message using a given private key @@ -118,7 +120,10 @@ extern int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int * \retval -1 on failure. * */ -extern int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key); +AST_OPTIONAL_API(int, ast_decrypt_bin, (unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key), { return -1; }); + +AST_OPTIONAL_API(int, ast_crypto_loaded, (void), { return 0; }); + #if defined(__cplusplus) || defined(c_plusplus) } #endif diff --git a/include/asterisk/optional_api.h b/include/asterisk/optional_api.h index df875a849..88ab238b4 100644 --- a/include/asterisk/optional_api.h +++ b/include/asterisk/optional_api.h @@ -80,6 +80,13 @@ * definition; this means that any consumers of the API functions so * defined will require that the provider of the API functions be * loaded before they can reference the symbols. + * + * WARNING WARNING WARNING WARNING WARNING + * + * You MUST add the AST_MODFLAG_GLOBAL_SYMBOLS to the module for which you + * are enabling optional_api functionality, or it will fail to work. + * + * WARNING WARNING WARNING WARNING WARNING */ #define __stringify_1(x) #x @@ -174,11 +181,11 @@ #define AST_OPTIONAL_API(result, name, proto, stub) \ result AST_OPTIONAL_API_NAME(name) proto; \ - __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name; + static __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name; #define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \ result __attribute__((attr)) AST_OPTIONAL_API_NAME(name) proto; \ - __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name; + static __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name; #else |