This function connects to a History Listener or MySQL database and collects all keys that have data associated with them for the given host and module. To be sure the host and module exist on the server, check that both exist within the lists returned by RSP_getHostsAndModules. The purpose of this function is to give users a list of keys to choose from when they want to view data. The parameter pd must have been created by a call to either RSP_newParseMySQL or RSP_newParseMySQL.
The remaining parameter pszKeys is a pointer to an array into which the function will place the key list. It is up to the user to free any data allocated to store these values. The following is an example of how to use this function:
RSP_parseData* pd; char **keys; int i = 0; pd = RSP_newParseRemote("127.0.0.1", 3496, 10); RSP_getKeys(pd, "plato", "CPUInfo", &keys); printf("Keys on server for plato-CPUInfo:\n"); i = 0; while(keys[i] != NULL) { printf("%s\n", keys[i]); free(keys[i++]); } free(keys); |
As you can see, the end of the array is specified with NULL. Make sure to free all non-NULL array entries as well as the array itself.
If an error occurs with this function, -1 is returned and rsp_error is set appropriately. Possible error values are:
RSP_NEED_MORE_DATA
RSP_INVALID_ARGS
RSP_SOCK_CREATE_FAILED
RSP_CONNECT_FAILED
RSP_LOW_MEM
RSP_LOST_CONNECTION
RSP_NO_SSL
RSP_SSL_SETUP_CONN
RSP_SSL_INVALID_CERT
RSP_MYSQL_INVALID