Lookup functions¶
- Lookup functions
- smf_lookup_result_free()
- smf_lookup_result_index()
- smf_lookup_element_get()
- smf_lookup_query()
- smf_lookup_connect()
- smf_lookup_disconnect()
- smf_lookup_db4_query()
- smf_lookup_sql_connect()
- smf_lookup_sql_disconnect()
- smf_lookup_sql_query()
- smf_lookup_ldap_connect()
- smf_lookup_ldap_disconnect()
- smf_lookup_ldap_query()
smf_lookup_result_free()¶
Frees all of the memory used by SMFLookupResult_T
1 void smf_lookup_result_free(SMFLookupResult_T *l);
Parameter
- l - a SMFLookupResult_T object
smf_lookup_result_index()¶
Returns SMFLookupElement_T at the given index of SMFLookupResult_T
1 SMFLookupElement_T *smf_lookup_result_index(SMFLookupResult_T *l, int i);
Parameter
- l - a SMFLookupResult_T object
- i - the index of the pointer to return
Return value
- returns a SMFLookupElement_T at the given index
smf_lookup_element_get()¶
Looks up a key in SMFLookupElement_T
1 void *smf_lookup_element_get(SMFLookupElement_T *e, char *key);
Parameter
- e - a SMFLookupElement_T object
- key - the key to look up
Return value
- returns the associated value, or NULL if the key is not found
smf_lookup_query()¶
Query lookup backend. The query statement can be either a SQL or LDAP statement, depending which backend you are using.
1 SMFLookupResult_T *smf_lookup_query(const char *q, ...);
Parameter
- q - a standard printf() format string
- args - the list of parameters to insert into the format string
Return value
- returns new allocated SMFLookupResult_T
smf_lookup_connect()¶
Establish database/ldap connection, normally done automatically.
1 int smf_lookup_connect(void);
Return value
- returns 0 on success or -1 in case of error
smf_lookup_disconnect()¶
Destroy database/ldap connection, normally done automatically.
1 int smf_lookup_disconnect(void);
Return value
- returns 0 on success or -1 in case of error
smf_lookup_db4_query()¶
Query Berkeley DB for given key
1 char *smf_lookup_db4_query(char *database, char *key);
Parameter
- database - path to database file
- key - key to lookup for
Return value
- returns the values associated with key, or NULL if the key is not found
smf_lookup_sql_connect()¶
Connect to sql server, normally not needed.
1 int smf_lookup_sql_connect(void);
Return value
- returns 0 on success or -1 in case of error
smf_lookup_sql_disconnect()¶
Disconnect from sql server, normally not needed.
1 void smf_lookup_sql_disconnect(void);
smf_lookup_sql_query()¶
Query SQL server with given query string
1 SMFLookupResult_T *smf_lookup_sql_query(const char *q, ...);
Parameter
- q - a standard printf() format string
- args - the list of parameters to insert into the format string
Return value
- returns new allocated SMFLookupResult_T
smf_lookup_ldap_connect()¶
Connect to ldap server, normally not needed.
1 int smf_lookup_ldap_connect(void);
Return value
- returns 0 on success or -1 in case of error
smf_lookup_ldap_disconnect()¶
Disconnect from LDAP server, normally not needed.
1 void smf_lookup_ldap_disconnect(void);
smf_lookup_ldap_query()¶
Query LDAP server with given query string
1 SMFLookupResult_T *smf_lookup_ldap_query(const char *q, ...);
Parameter
- q - a standard printf() format string
- args - the list of parameters to insert into the format string
Return value
- returns new allocated SMFLookupResult_T