![]() |
![]() |
![]() |
PSKC Library Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum pskc_rc; const char * pskc_strerror (int err
); const char * pskc_strerror_name (int err
);
Most library functions uses an int return value to indicate success
or failure, using pskc_rc values. The values can be converted
into human readable explanations using pskc_strerror()
. The
symbolic error codes can be converted into strings using
pskc_strerror_name()
.
typedef enum { PSKC_OK = 0, PSKC_MALLOC_ERROR = -1, PSKC_XML_ERROR = -2, PSKC_PARSE_ERROR = -3, PSKC_BASE64_ERROR = -4, PSKC_UNKNOWN_OUTPUT_FORMAT = -5, /* When adding anything above, you need to update errors.c and the following constant. */ PSKC_LAST_ERROR = -5 } pskc_rc;
Return codes for PSKC functions. All return codes are negative
except for the successful code PSKC_OK
which are guaranteed to be
0. Positive values are reserved for non-error return codes.
Note that the pskc_rc enumeration may be extended at a later date to include new return codes.
Successful return. | |
Memory allocation failed. | |
Error returned from XML library. | |
Error parsing PSKC data. | |
Error decoding base64 data. | |
Unknown output format. | |
Meta-error indicating the last error code, for use when iterating over all error codes or similar. |
const char * pskc_strerror (int err
);
Convert return code to human readable string explanation of the reason for the particular error code.
This string can be used to output a diagnostic message to the user.
This function is one of few in the library that can be used without
a successful call to pskc_init()
.
|
error code, a pskc_rc value. |
Returns : |
Returns a pointer to a statically allocated string
containing an explanation of the error code err . |
const char * pskc_strerror_name (int err
);
Convert return code to human readable string representing the error
code symbol itself. For example, pskc_strerror_name(PSKC_OK
)
returns the string "PSKC_OK".
This string can be used to output a diagnostic message to the user.
This function is one of few in the library that can be used without
a successful call to pskc_init()
.
|
error code, a pskc_rc value. |
Returns : |
Returns a pointer to a statically allocated string
containing a string version of the error code err , or NULL if
the error code is not known. |