\r\n

51Degrees Device Detection C/C++  4.4

A device detection library that is used natively or by 51Degrees products

Status

Detailed Description

Status codes and messages indicating the result of an operation.

Introduction

A status code is an enum indicating the result of an operation, usually the initialisation of something. If the status is anything other than FIFTYONE_DEGREES_STATUS_SUCCESS, then the operation was not successful. In that case, the status code indicates the nature of the failure.

A status code can be returned by any method that wishes to report a specific error rather than just returning NULL.

Examples of error status codes are insufficient memory or corrupt data. If an operation was successful then this is reported in the same way by returning a success status code.

Status codes have related messages which can be fetched using the fiftyoneDegreesStatusGetMessage method. The messages are intended to be useful messages which are returned to the user in the event of an error occurring.

Usage Example

const char *fileName;
// Check whether the result of an operation was successful
// Get the status message as the operation has not succeeded
const char *message = fiftyoneDegreesStatusGetMessage(status, fileName);
// Do something with the message
// ...
}

Collaboration diagram for Status:

Enumerations

enum  fiftyoneDegreesStatusCode {
  FIFTYONE_DEGREES_STATUS_SUCCESS, FIFTYONE_DEGREES_STATUS_INSUFFICIENT_MEMORY, FIFTYONE_DEGREES_STATUS_CORRUPT_DATA, FIFTYONE_DEGREES_STATUS_INCORRECT_VERSION,
  FIFTYONE_DEGREES_STATUS_FILE_NOT_FOUND, FIFTYONE_DEGREES_STATUS_FILE_BUSY, FIFTYONE_DEGREES_STATUS_FILE_FAILURE, FIFTYONE_DEGREES_STATUS_NOT_SET,
  FIFTYONE_DEGREES_STATUS_POINTER_OUT_OF_BOUNDS, FIFTYONE_DEGREES_STATUS_NULL_POINTER, FIFTYONE_DEGREES_STATUS_TOO_MANY_OPEN_FILES, FIFTYONE_DEGREES_STATUS_REQ_PROP_NOT_PRESENT,
  FIFTYONE_DEGREES_STATUS_PROFILE_EMPTY, FIFTYONE_DEGREES_STATUS_COLLECTION_FAILURE, FIFTYONE_DEGREES_STATUS_FILE_COPY_ERROR, FIFTYONE_DEGREES_STATUS_FILE_EXISTS_ERROR,
  FIFTYONE_DEGREES_STATUS_FILE_WRITE_ERROR, FIFTYONE_DEGREES_STATUS_FILE_READ_ERROR, FIFTYONE_DEGREES_STATUS_FILE_PERMISSION_DENIED, FIFTYONE_DEGREES_STATUS_FILE_PATH_TOO_LONG,
  FIFTYONE_DEGREES_STATUS_FILE_END_OF_DOCUMENT, FIFTYONE_DEGREES_STATUS_FILE_END_OF_DOCUMENTS, FIFTYONE_DEGREES_STATUS_FILE_END_OF_FILE, FIFTYONE_DEGREES_STATUS_ENCODING_ERROR,
  FIFTYONE_DEGREES_STATUS_INVALID_COLLECTION_CONFIG, FIFTYONE_DEGREES_STATUS_INVALID_CONFIG, FIFTYONE_DEGREES_STATUS_INSUFFICIENT_HANDLES, FIFTYONE_DEGREES_STATUS_COLLECTION_INDEX_OUT_OF_RANGE,
  FIFTYONE_DEGREES_STATUS_COLLECTION_OFFSET_OUT_OF_RANGE, FIFTYONE_DEGREES_STATUS_COLLECTION_FILE_SEEK_FAIL, FIFTYONE_DEGREES_STATUS_COLLECTION_FILE_READ_FAIL, FIFTYONE_DEGREES_STATUS_INCORRECT_IP_ADDRESS_FORMAT,
  FIFTYONE_DEGREES_STATUS_TEMP_FILE_ERROR
}
Status returned from the initialisation of a resource. More...

Functions

const char *  fiftyoneDegreesStatusGetMessage (fiftyoneDegreesStatusCode status, const char *fileName)
Returns an English error message for the status code allocating memory needed to store the message. More...

Enumeration Type Documentation

◆ fiftyoneDegreesStatusCode

Status returned from the initialisation of a resource.

Enumerator

FIFTYONE_DEGREES_STATUS_SUCCESS 

All okay.

FIFTYONE_DEGREES_STATUS_INSUFFICIENT_MEMORY 

Lack of memory.

FIFTYONE_DEGREES_STATUS_CORRUPT_DATA 

Data structure not readable.

FIFTYONE_DEGREES_STATUS_INCORRECT_VERSION 

Data not the required version.

FIFTYONE_DEGREES_STATUS_FILE_NOT_FOUND 

The data file couldn't be found.

FIFTYONE_DEGREES_STATUS_FILE_BUSY 

The data file was busy.

FIFTYONE_DEGREES_STATUS_FILE_FAILURE 

Unknown file error.

FIFTYONE_DEGREES_STATUS_NOT_SET 

Should never be returned to the caller.

FIFTYONE_DEGREES_STATUS_POINTER_OUT_OF_BOUNDS 

Working pointer exceeded the amount of memory containing the data.

FIFTYONE_DEGREES_STATUS_NULL_POINTER 

A key pointer was not set.

FIFTYONE_DEGREES_STATUS_TOO_MANY_OPEN_FILES 

Too many files are open.

FIFTYONE_DEGREES_STATUS_REQ_PROP_NOT_PRESENT 

None of the required properties could be found.

FIFTYONE_DEGREES_STATUS_PROFILE_EMPTY 

The profile id represents an empty profile.

FIFTYONE_DEGREES_STATUS_COLLECTION_FAILURE 

There was an error getting an item from a collection due to too many concurrent operations.

FIFTYONE_DEGREES_STATUS_FILE_COPY_ERROR 

The data file could not be copied.

FIFTYONE_DEGREES_STATUS_FILE_EXISTS_ERROR 

The file or directory already exists, so could not be created.

FIFTYONE_DEGREES_STATUS_FILE_WRITE_ERROR 

The data file could not be created.

FIFTYONE_DEGREES_STATUS_FILE_READ_ERROR 

The data file could not be cread.

FIFTYONE_DEGREES_STATUS_FILE_PERMISSION_DENIED 

File permission denied.

FIFTYONE_DEGREES_STATUS_FILE_PATH_TOO_LONG 

The file path is longer than the available memory available to store it.

FIFTYONE_DEGREES_STATUS_FILE_END_OF_DOCUMENT 

End of a yaml document read.

FIFTYONE_DEGREES_STATUS_FILE_END_OF_DOCUMENTS 

End of yaml documents read.

FIFTYONE_DEGREES_STATUS_FILE_END_OF_FILE 

End of file.

FIFTYONE_DEGREES_STATUS_ENCODING_ERROR 

There was an error encoding characters of a string.

FIFTYONE_DEGREES_STATUS_INVALID_COLLECTION_CONFIG 

The configuration provided to create a collection could not be used to create a valid collection.

FIFTYONE_DEGREES_STATUS_INVALID_CONFIG 

An invalid config was provided.

FIFTYONE_DEGREES_STATUS_INSUFFICIENT_HANDLES 

There were not enough handles available to retrieve data from the source.

FIFTYONE_DEGREES_STATUS_COLLECTION_INDEX_OUT_OF_RANGE 

Index out of range.

FIFTYONE_DEGREES_STATUS_COLLECTION_OFFSET_OUT_OF_RANGE 

Offset out of range.

FIFTYONE_DEGREES_STATUS_COLLECTION_FILE_SEEK_FAIL 

Seek failure.

FIFTYONE_DEGREES_STATUS_COLLECTION_FILE_READ_FAIL 

Read failure.

FIFTYONE_DEGREES_STATUS_INCORRECT_IP_ADDRESS_FORMAT 

IP address format is incorrect.

FIFTYONE_DEGREES_STATUS_TEMP_FILE_ERROR 

Error creating temp file.

Function Documentation

◆ fiftyoneDegreesStatusGetMessage()

const char* fiftyoneDegreesStatusGetMessage ( fiftyoneDegreesStatusCode   status,
const char *   fileName  
)

Returns an English error message for the status code allocating memory needed to store the message.

The caller must free the memory when they have finished consuming the error message.

Parameters
status - code to get the message for
fileName - the source file used for initialisation, or NULL if not applicable to the status code
Returns
pointer to the newly allocated message string
On This Page