diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/channel.h | 21 | ||||
-rw-r--r-- | include/asterisk/frame.h | 7 | ||||
-rw-r--r-- | include/asterisk/pbx.h | 7 |
3 files changed, 32 insertions, 3 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index b0f589a9d..8b8094e37 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -468,6 +468,27 @@ struct ast_set_party_redirecting { struct ast_set_party_id to; }; +/*! \brief Typedef for a custom read function */ +typedef int (*ast_acf_read_fn_t)(struct ast_channel *, const char *, char *, char *, size_t); + +/*! \brief Typedef for a custom read2 function */ +typedef int (*ast_acf_read2_fn_t)(struct ast_channel *, const char *, char *, struct ast_str **, ssize_t); + +/*! \brief Typedef for a custom write function */ +typedef int (*ast_acf_write_fn_t)(struct ast_channel *, const char *, char *, const char *); + +/*! \brief Structure to handle passing func_channel_write info to channels via setoption */ +typedef struct { + /*! \brief ast_chan_write_info_t version. Must be incremented if structure is changed */ + #define AST_CHAN_WRITE_INFO_T_VERSION 1 + uint32_t version; + ast_acf_write_fn_t write_fn; + struct ast_channel *chan; + const char *function; + char *data; + const char *value; +} ast_chan_write_info_t; + /*! * \brief * Structure to describe a channel "technology", ie a channel driver diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h index 5cf137fae..3755c5b50 100644 --- a/include/asterisk/frame.h +++ b/include/asterisk/frame.h @@ -436,6 +436,13 @@ enum ast_control_transfer { /*! Explicitly enable or disable echo cancelation for the given channel */ #define AST_OPTION_ECHOCAN 8 +/*! \brief Handle channel write data + * If a channel needs to process the data from a func_channel write operation + * after func_channel_write executes, it can define the setoption callback + * and process this option. A pointer to an ast_chan_write_info_t will be passed. + * */ +#define AST_OPTION_CHANNEL_WRITE 9 + /* ! * Read-only. Allows query current status of T38 on the channel. * data: ast_t38state diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index a0ef3d476..e80a303f6 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -23,6 +23,7 @@ #ifndef _ASTERISK_PBX_H #define _ASTERISK_PBX_H +#include "asterisk/channel.h" #include "asterisk/sched.h" #include "asterisk/devicestate.h" #include "asterisk/chanvars.h" @@ -89,7 +90,7 @@ struct ast_custom_function { ); enum ast_doc_src docsrc; /*!< Where the documentation come from */ /*! Read function, if read is supported */ - int (*read)(struct ast_channel *, const char *, char *, char *, size_t); + ast_acf_read_fn_t read; /*!< Read function, if read is supported */ /*! Read function, if read is supported. Note: only one of read or read2 * needs to be implemented. In new code, read2 should be implemented as * the way forward, but they should return identical results, within the @@ -97,11 +98,11 @@ struct ast_custom_function { * read function is handed a 16-byte buffer, and the result is 17 bytes * long, then the first 15 bytes (remember NULL terminator) should be * the same for both the read and the read2 methods. */ - int (*read2)(struct ast_channel *, const char *, char *, struct ast_str **, ssize_t); + ast_acf_read2_fn_t read2; /*! If no read2 function is provided, what maximum size? */ size_t read_max; /*! Write function, if write is supported */ - int (*write)(struct ast_channel *, const char *, char *, const char *); + ast_acf_write_fn_t write; /*!< Write function, if write is supported */ struct ast_module *mod; /*!< Module this custom function belongs to */ AST_RWLIST_ENTRY(ast_custom_function) acflist; }; |