From: Bert Vermeulen Date: Sun, 3 Aug 2014 13:12:49 +0000 (+0200) Subject: input: make sr_input{_module} opaque to clients. X-Git-Tag: libsigrok-0.4.0~1117 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=d514d35dab8b831264c8cb01444cf0bb5abbbf8f;p=libsigrok.git input: make sr_input{_module} opaque to clients. --- diff --git a/include/libsigrok/libsigrok.h b/include/libsigrok/libsigrok.h index 1a076d6a..1f20e1d6 100644 --- a/include/libsigrok/libsigrok.h +++ b/include/libsigrok/libsigrok.h @@ -443,78 +443,8 @@ struct sr_option { GSList *values; }; -/** Input (file) module struct. */ -struct sr_input { - /** - * A pointer to this input module's 'struct sr_input_module'. - * The frontend can use this to call the module's callbacks. - */ - struct sr_input_module *module; - - GHashTable *param; - - struct sr_dev_inst *sdi; - - void *internal; -}; - -/** Input (file) module driver. */ -struct sr_input_module { - /** The unique ID for this input module. Must not be NULL. */ - char *id; - - /** - * A short description of the input module, which can (for example) - * be displayed to the user by frontends. Must not be NULL. - */ - char *description; - - /** - * Check if this input module can load and parse the specified file. - * - * @param[in] filename The name (and path) of the file to check. - * - * @retval TRUE This module knows the format. - * @retval FALSE This module does not know the format. - */ - int (*format_match) (const char *filename); - - /** - * Initialize the input module. - * - * @param in A pointer to a valid 'struct sr_input' that the caller - * has to allocate and provide to this function. It is also - * the responsibility of the caller to free it later. - * @param[in] filename The name (and path) of the file to use. - * - * @retval SR_OK Success - * @retval other Negative error code. - */ - int (*init) (struct sr_input *in, const char *filename); - - /** - * Load a file, parsing the input according to the file's format. - * - * This function will send datafeed packets to the session bus, so - * the calling frontend must have registered its session callbacks - * beforehand. - * - * The packet types sent across the session bus by this function must - * include at least SR_DF_HEADER, SR_DF_END, and an appropriate data - * type such as SR_DF_LOGIC. It may also send a SR_DF_TRIGGER packet - * if appropriate. - * - * @param in A pointer to a valid 'struct sr_input' that the caller - * has to allocate and provide to this function. It is also - * the responsibility of the caller to free it later. - * @param filename The name (and path) of the file to use. - * - * @retval SR_OK Success - * @retval other Negative error code. - */ - int (*loadfile) (struct sr_input *in, const char *filename); -}; - +struct sr_input; +struct sr_input_module; struct sr_output; struct sr_output_module; diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 6ce86883..da04c111 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -168,6 +168,78 @@ struct sr_context { #endif }; +/** Input (file) module struct. */ +struct sr_input { + /** + * A pointer to this input module's 'struct sr_input_module'. + * The frontend can use this to call the module's callbacks. + */ + struct sr_input_module *module; + + GHashTable *param; + + struct sr_dev_inst *sdi; + + void *internal; +}; + +/** Input (file) module driver. */ +struct sr_input_module { + /** The unique ID for this input module. Must not be NULL. */ + char *id; + + /** + * A short description of the input module, which can (for example) + * be displayed to the user by frontends. Must not be NULL. + */ + char *description; + + /** + * Check if this input module can load and parse the specified file. + * + * @param[in] filename The name (and path) of the file to check. + * + * @retval TRUE This module knows the format. + * @retval FALSE This module does not know the format. + */ + int (*format_match) (const char *filename); + + /** + * Initialize the input module. + * + * @param in A pointer to a valid 'struct sr_input' that the caller + * has to allocate and provide to this function. It is also + * the responsibility of the caller to free it later. + * @param[in] filename The name (and path) of the file to use. + * + * @retval SR_OK Success + * @retval other Negative error code. + */ + int (*init) (struct sr_input *in, const char *filename); + + /** + * Load a file, parsing the input according to the file's format. + * + * This function will send datafeed packets to the session bus, so + * the calling frontend must have registered its session callbacks + * beforehand. + * + * The packet types sent across the session bus by this function must + * include at least SR_DF_HEADER, SR_DF_END, and an appropriate data + * type such as SR_DF_LOGIC. It may also send a SR_DF_TRIGGER packet + * if appropriate. + * + * @param in A pointer to a valid 'struct sr_input' that the caller + * has to allocate and provide to this function. It is also + * the responsibility of the caller to free it later. + * @param filename The name (and path) of the file to use. + * + * @retval SR_OK Success + * @retval other Negative error code. + */ + int (*loadfile) (struct sr_input *in, const char *filename); +}; + /** Output module instance. */ struct sr_output { /** A pointer to this output's module. */