summaryrefslogtreecommitdiff
path: root/libunbound/unbound.h
diff options
context:
space:
mode:
Diffstat (limited to 'libunbound/unbound.h')
-rw-r--r--libunbound/unbound.h40
1 files changed, 25 insertions, 15 deletions
diff --git a/libunbound/unbound.h b/libunbound/unbound.h
index d435bf28d35e..191338706c3d 100644
--- a/libunbound/unbound.h
+++ b/libunbound/unbound.h
@@ -78,6 +78,10 @@
* ... same as async for non-threaded
* ... the callbacks are called in the thread that calls process(ctx)
*
+ * Openssl needs to have locking in place, and the application must set
+ * it up, because a mere library cannot do this, use the calls
+ * CRYPTO_set_id_callback and CRYPTO_set_locking_callback.
+ *
* If no threading is compiled in, the above async example uses fork(2) to
* create a process to perform the work. The forked process exits when the
* calling process exits, or ctx_delete() is called.
@@ -97,6 +101,11 @@
extern "C" {
#endif
+/** the version of this header file */
+#define UNBOUND_VERSION_MAJOR @UNBOUND_VERSION_MAJOR@
+#define UNBOUND_VERSION_MINOR @UNBOUND_VERSION_MINOR@
+#define UNBOUND_VERSION_MICRO @UNBOUND_VERSION_MICRO@
+
/**
* The validation context is created to hold the resolver status,
* validation keys and a small cache (containing messages, rrsets,
@@ -245,7 +254,7 @@ void ub_ctx_delete(struct ub_ctx* ctx);
* @param val: value of the option.
* @return: 0 if OK, else error.
*/
-int ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val);
+int ub_ctx_set_option(struct ub_ctx* ctx, const char* opt, const char* val);
/**
* Get an option from the context.
@@ -261,7 +270,7 @@ int ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val);
* returned in the string.
* @return 0 if OK else an error code (malloc failure, syntax error).
*/
-int ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str);
+int ub_ctx_get_option(struct ub_ctx* ctx, const char* opt, char** str);
/**
* setup configuration for the given context.
@@ -273,7 +282,7 @@ int ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str);
* routines exist.
* @return: 0 if OK, else error.
*/
-int ub_ctx_config(struct ub_ctx* ctx, char* fname);
+int ub_ctx_config(struct ub_ctx* ctx, const char* fname);
/**
* Set machine to forward DNS queries to, the caching resolver to use.
@@ -292,7 +301,7 @@ int ub_ctx_config(struct ub_ctx* ctx, char* fname);
* If the addr is NULL, forwarding is disabled.
* @return 0 if OK, else error.
*/
-int ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr);
+int ub_ctx_set_fwd(struct ub_ctx* ctx, const char* addr);
/**
* Read list of nameservers to use from the filename given.
@@ -308,7 +317,7 @@ int ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr);
* @param fname: file name string. If NULL "/etc/resolv.conf" is used.
* @return 0 if OK, else error.
*/
-int ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname);
+int ub_ctx_resolvconf(struct ub_ctx* ctx, const char* fname);
/**
* Read list of hosts from the filename given.
@@ -321,7 +330,7 @@ int ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname);
* @param fname: file name string. If NULL "/etc/hosts" is used.
* @return 0 if OK, else error.
*/
-int ub_ctx_hosts(struct ub_ctx* ctx, char* fname);
+int ub_ctx_hosts(struct ub_ctx* ctx, const char* fname);
/**
* Add a trust anchor to the given context.
@@ -334,7 +343,7 @@ int ub_ctx_hosts(struct ub_ctx* ctx, char* fname);
* [domainname] [TTL optional] [type] [class optional] [rdata contents]
* @return 0 if OK, else error.
*/
-int ub_ctx_add_ta(struct ub_ctx* ctx, char* ta);
+int ub_ctx_add_ta(struct ub_ctx* ctx, const char* ta);
/**
* Add trust anchors to the given context.
@@ -345,7 +354,7 @@ int ub_ctx_add_ta(struct ub_ctx* ctx, char* ta);
* @param fname: filename of file with keyfile with trust anchors.
* @return 0 if OK, else error.
*/
-int ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname);
+int ub_ctx_add_ta_file(struct ub_ctx* ctx, const char* fname);
/**
* Add trust anchors to the given context.
@@ -357,7 +366,7 @@ int ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname);
* anchors.
* @return 0 if OK, else error.
*/
-int ub_ctx_trustedkeys(struct ub_ctx* ctx, char* fname);
+int ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname);
/**
* Set debug output (and error output) to the specified stream.
@@ -442,7 +451,7 @@ int ub_process(struct ub_ctx* ctx);
* in that case (out of memory).
* @return 0 if OK, else error.
*/
-int ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
+int ub_resolve(struct ub_ctx* ctx, const char* name, int rrtype,
int rrclass, struct ub_result** result);
/**
@@ -473,7 +482,7 @@ int ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
* cancel the query.
* @return 0 if OK, else error.
*/
-int ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype,
+int ub_resolve_async(struct ub_ctx* ctx, const char* name, int rrtype,
int rrclass, void* mydata, ub_callback_t callback, int* async_id);
/**
@@ -520,7 +529,8 @@ int ub_ctx_print_local_zones(struct ub_ctx* ctx);
* @param zone_type: type of the zone (like for unbound.conf) in text.
* @return 0 if OK, else error.
*/
-int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type);
+int ub_ctx_zone_add(struct ub_ctx* ctx, const char *zone_name,
+ const char *zone_type);
/**
* Remove zone from local authority info of the library.
@@ -529,7 +539,7 @@ int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type);
* If it does not exist, nothing happens.
* @return 0 if OK, else error.
*/
-int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name);
+int ub_ctx_zone_remove(struct ub_ctx* ctx, const char *zone_name);
/**
* Add localdata to the library local authority info.
@@ -539,7 +549,7 @@ int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name);
* "www.example.com IN A 127.0.0.1"
* @return 0 if OK, else error.
*/
-int ub_ctx_data_add(struct ub_ctx* ctx, char *data);
+int ub_ctx_data_add(struct ub_ctx* ctx, const char *data);
/**
* Remove localdata from the library local authority info.
@@ -547,7 +557,7 @@ int ub_ctx_data_add(struct ub_ctx* ctx, char *data);
* @param data: the name to delete all data from, like "www.example.com".
* @return 0 if OK, else error.
*/
-int ub_ctx_data_remove(struct ub_ctx* ctx, char *data);
+int ub_ctx_data_remove(struct ub_ctx* ctx, const char *data);
/**
* Get a version string from the libunbound implementation.