Next: CMS Parser, Up: CMS
All operations with the CMS framework require the use of a so called CMS object which is internally used to keep track of the current state and to store some meta information.
The
ksba_stop_reason_t
type is an enumeration used for communication between the phases of a parsing or building process.
This function creates a new CMS object. The only reason the function may fail is an out-of-memory condition in which case
NULL
is returned. It is safe for the caller to translate this to the standard error codeGPG_ERR_ENOMEM
. Any object created with this function should be released after use by usingksba_cms_release
.
Release all resources associated with the CMS object. It is perfectly okay to pass
NULL
to this function in which case nothing happens.
About all usages of the CMS framework require some input and output data (great surprise!). To accomplish this in the most abstract way, no direct output functions are used - instead special reader and writer objects are used instead. Depending on the desired operations either a reader, a writer or both must be given. Associate a reader object with cms by passing it as r and a writer object by passing it as w. Note that no reference counting is done,so make sure that those objects have a lifetime at least as long as CMS.
If you forget to set these objects, you will get an appropriate error later when data is actually to be read or written. The function returns zero on success or an error code when invalid objects are passed.