#include "ks_config.h"
#include "ks_bquery.h"
#include "ks_malloc.h"
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Functions | |
| ks_type_t * | ks_bquery_type (void) |
| ks_bquery_t * | ks_bquery_new (void) |
| void | ks_bquery_free (ks_bquery_t *q) |
| void | ks_bquery_id_set (ks_bquery_t *q, const char *id, size_t len) |
| ks_string_t * | ks_bquery_id_get (ks_bquery_t *q) |
| void | ks_bquery_feed_add (ks_bquery_t *q, const char *id) |
| void | ks_bquery_composite_add (ks_bquery_t *q, const char *id) |
| void | ks_bquery_combiner_add (ks_bquery_t *q, const char *id) |
| void | ks_bquery_identity_add (ks_bquery_t *q, const char *id, int idt) |
| void | ks_bquery_identity_add_tagged (ks_bquery_t *q, const char *id, int idt, const char *tag) |
| void | ks_bquery_flags_set (ks_bquery_t *q, long flags) |
| ks_string_t * | ks_bquery_packet (ks_bquery_t *q) |
| int | ks_bquery_has_auth (ks_bquery_t *q) |
| void | ks_bquery_set_auth (ks_bquery_t *q, const char *p, const char *c) |
Definition in file ks_bquery.c.
| void ks_bquery_combiner_add | ( | ks_bquery_t * | q, | |
| const char * | id | |||
| ) |
Add an additional combiner ito be queried to a ks_bquery_t.
| q | a pointer to the ks_bquery_t to which the combiner is to be added | |
| id | the combiner's name (a NUL terminated string) |
Definition at line 260 of file ks_bquery.c.
References _ks_bquery_t::combiners, ks_array_add(), and ks_string_new().
| void ks_bquery_composite_add | ( | ks_bquery_t * | q, | |
| const char * | id | |||
| ) |
Add a composite (aka feedset) to be queried to a ks_bquery_packet.
| q | a pointer to the ks_bquery_t to which the composite should be added | |
| id | the name of the composite to be queried (a NUL terminated string) |
Definition at line 245 of file ks_bquery.c.
References _ks_bquery_t::composites, ks_array_add(), and ks_string_new().
Referenced by main().
| void ks_bquery_feed_add | ( | ks_bquery_t * | q, | |
| const char * | id | |||
| ) |
Adds a feed to be queried to a ks_bquery_t.
| q | a pointer to the ks_bquery_t the feed is to be added to | |
| id | the number of the id to be queried |
Definition at line 229 of file ks_bquery.c.
References _ks_bquery_t::feeds, ks_array_add(), and ks_string_new().
Referenced by main().
| void ks_bquery_flags_set | ( | ks_bquery_t * | q, | |
| long | flags | |||
| ) |
Set the flags in a ks_bquery_t.
| q | a pointer to the ks_bquery_t whose flags are to be set | |
| flags | the flags to be set XOR'd together. Valid flags are:
|
Definition at line 355 of file ks_bquery.c.
References _ks_bquery_t::flags, and ks_number_set().
Referenced by main().
| void ks_bquery_free | ( | ks_bquery_t * | q | ) |
Destroys a ks_bquery_t, freeing all memory that has been allocated for it.
| q | a pointer to the ks_bquery_t to be destroyed |
Definition at line 159 of file ks_bquery.c.
References _ks_bquery_t::combiners, _ks_bquery_t::composites, _ks_bquery_t::credentials, _ks_bquery_t::feeds, _ks_bquery_t::flags, _ks_bquery_t::id, _ks_bquery_t::identities, ks_array_fini(), ks_free(), ks_number_fini(), ks_string_free(), and _ks_bquery_t::principal.
Referenced by main().
| int ks_bquery_has_auth | ( | ks_bquery_t * | q | ) |
Determine whether or not a ks_bquery_t has authentication tokens.
| q | a pointer to the ks_bquery_t being inspected |
Definition at line 386 of file ks_bquery.c.
References _ks_bquery_t::principal.
Referenced by ks_socket_send().
| ks_string_t* ks_bquery_id_get | ( | ks_bquery_t * | q | ) |
Returns the cookie value from a ks_bquery_t.
If the ks_bquery_t does not already have an ID, one is generated and stored within it. libkarmaclient does not generate bquery packets that do not have cookies.
| q | a pointer to the ks_bquery_t whose id is to be inspected |
Definition at line 210 of file ks_bquery.c.
References _ks_bquery_t::id, and ks_string_new().
Referenced by ks_socket_ask().
| void ks_bquery_id_set | ( | ks_bquery_t * | q, | |
| const char * | id, | |||
| size_t | len | |||
| ) |
Sets the value of the cookie for this query.
This will be returned by the karmaserver in the response packet to allow the client to keep track of query/response pairs.
| q | a pointer to the ks_bquery_t whose id is to be set | |
| id | a string to uniquely identify this ks_bquery_t and its associated ks_response_t | |
| len | the length of the id string (in chars) |
Definition at line 189 of file ks_bquery.c.
References _ks_bquery_t::id, ks_string_new(), and ks_string_set().
| void ks_bquery_identity_add | ( | ks_bquery_t * | q, | |
| const char * | id, | |||
| int | idt | |||
| ) |
Add an identity (on which an opinion is sought from a karmaserver) to a ks_bquery_t.
To pass additional context information about the identity, use ks_bquery_identity_add_tagged.
| q | a pointer to the ks_bquery_t to which the identity should be added. | |
| id | the identity to add to the ks_bquery_t (a NUL terminated string) | |
| idt | an integer describing the type of the identity. Valid values for types are:
|
Definition at line 314 of file ks_bquery.c.
| void ks_bquery_identity_add_tagged | ( | ks_bquery_t * | q, | |
| const char * | id, | |||
| int | idt, | |||
| const char * | tag | |||
| ) |
Add an identity (on which an opinion is sought from a karmaserver) and a tag string to a ks_bquery_t.
| q | a pointer to the ks_bquery_t to which the identity should be added. | |
| id | the identity to add to the ks_bquery_t (a NUL terminated string) | |
| idt | an integer describing the type of the identity. Valid values for types are:
| |
| tag | a NUL terminated string to be used as a tag |
Definition at line 338 of file ks_bquery.c.
References ks_array_add(), and ks_string_new().
| ks_bquery_t* ks_bquery_new | ( | void | ) |
Constructs a new ks_bquery_t.
This function allocates memory that must be freed by ks_bquery_free().
Definition at line 135 of file ks_bquery.c.
References _ks_bquery_t::base, _ks_bquery_t::combiners, _ks_bquery_t::composites, _ks_bquery_t::credentials, _ks_bquery_t::feeds, _ks_bquery_t::flags, _ks_bquery_t::id, _ks_bquery_t::identities, ks_array_init(), ks_malloc(), ks_number_init(), _ks_bquery_t::principal, and _ks_base_t::type.
Referenced by main().
| ks_string_t* ks_bquery_packet | ( | ks_bquery_t * | q | ) |
Convert a ks_bquery_t object into a bquery packet.
| q | a pointer to the ks_bquery_t to be converted |
Definition at line 370 of file ks_bquery.c.
References ks_string_new().
Referenced by ks_socket_send().
| void ks_bquery_set_auth | ( | ks_bquery_t * | q, | |
| const char * | p, | |||
| const char * | c | |||
| ) |
Set authentication tokens for a bquery object.
| q | a pointer to the ks_bquery_t to be authenticated | |
| p | a NUL terminated string containing an identifier used to authenticate client connections. This may be a login or account name. The precise details will depend on the policy of the query server being used. | |
| c | a NUL terminated string containing the credentials used to authenticate the principal, p. this may be a password, or a certificate. The precise details may depend on the policy of the query server being used. |
Definition at line 407 of file ks_bquery.c.
References _ks_bquery_t::credentials, ks_string_free(), ks_string_new(), ks_string_set(), and _ks_bquery_t::principal.
Referenced by ks_socket_send().
| ks_type_t* ks_bquery_type | ( | void | ) |
Returns the metaclass for ks_bquery_t objects.
Definition at line 120 of file ks_bquery.c.
1.5.1