mirror of https://github.com/getdnsapi/getdns.git
began tweaking sources to match BSD coding style
This commit is contained in:
parent
3f33ae19b4
commit
a659f2562e
10
README.md
10
README.md
|
@ -16,7 +16,7 @@ The goals of this implemtation of the getdns API are:
|
|||
* Include examples and tests as part of the build
|
||||
* Document code using doxygen
|
||||
* Leverage github as much as possible for project coordination
|
||||
* Coding style/standards follow the BSD coding style
|
||||
* Coding style/standards follow the [BSD coding style](ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/style)
|
||||
* Follow the git flow branching model described at <http://nvie.com/posts/a-successful-git-branching-model/>
|
||||
* Both synchronous and asynchronous entry points with an early focus on the asynchronous model
|
||||
|
||||
|
@ -37,7 +37,13 @@ Although [libevent](http://libevent.org) is used initially to implement the asyn
|
|||
|
||||
Current State of the Implementation
|
||||
===================================
|
||||
TBD
|
||||
We are currently in the early stages of building the API so the code should be considered incomplete. The current target platforms and the personal primarily responsible for ensuring it builds and runs on that platform include:
|
||||
|
||||
* Android, Neel Goyal
|
||||
* FreeBSD, Melinda Shore
|
||||
* Linux RHEL/CentOS 6.x, Glen Wiley
|
||||
* MS-Windows 8, Neel Goyal
|
||||
* OSX 10.8, Glen Wiley
|
||||
|
||||
--
|
||||
end README
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Neel Goyal <ngoyal@verisign.com>
|
||||
Allison Mankin <amankin@verisign.com>
|
||||
Melinda Shore <melinda.shore@nomountain.net>
|
||||
Glen Wiley <gwiley@verisign.com>
|
|
@ -1 +0,0 @@
|
|||
/usr/share/automake-1.11/COPYING
|
|
@ -1,3 +1,29 @@
|
|||
/* example-simple-answers.c
|
||||
*
|
||||
* Originally taken from the getdns API description pseudo implementation.
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2013 Verisign, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -53,7 +79,8 @@ void this_callbackfn(struct getdns_context_t *this_context,
|
|||
fprintf(stderr, "The callback got a callback_type of %d. Exiting.", this_callback_type);
|
||||
}
|
||||
|
||||
int main()
|
||||
int
|
||||
main()
|
||||
{
|
||||
/* Create the DNS context for this call */
|
||||
struct getdns_context_t *this_context = NULL;
|
||||
|
@ -96,4 +123,5 @@ int main()
|
|||
getdns_context_destroy(this_context);
|
||||
/* Assuming we get here, leave gracefully */
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
} /* main */
|
||||
/* example-simple-answers.c */
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
/* example-synchronous.c
|
||||
*
|
||||
* Originally taken from the getdns API description pseudo implementation.
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2013 Verisign, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -5,30 +32,41 @@
|
|||
#include <inttypes.h>
|
||||
#include <getdns_core_only.h>
|
||||
|
||||
int main()
|
||||
int
|
||||
main()
|
||||
{
|
||||
getdns_return_t this_ret; /* Holder for all function returns */
|
||||
getdns_return_t context_create_return;
|
||||
struct getdns_list *just_the_addresses_ptr;
|
||||
size_t *num_addresses_ptr = NULL;
|
||||
size_t rec_count;
|
||||
struct getdns_dict *this_address;
|
||||
struct getdns_bindata *this_address_data;
|
||||
struct getdns_context_t *this_context = NULL;
|
||||
uint32_t *this_error = NULL;
|
||||
struct getdns_dict *this_extensions = NULL;
|
||||
const char *this_name = "www.example.com";
|
||||
uint8_t this_request_type = GETDNS_RRTYPE_A;
|
||||
struct getdns_dict *this_response = NULL;
|
||||
uint32_t this_response_length;
|
||||
getdns_return_t this_ret;
|
||||
|
||||
/* Create the DNS context for this call */
|
||||
struct getdns_context_t *this_context = NULL;
|
||||
getdns_return_t context_create_return = getdns_context_create(&this_context, true);
|
||||
context_create_return = getdns_context_create(&this_context, true);
|
||||
if (context_create_return != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
fprintf(stderr, "Trying to create the context failed: %d", context_create_return);
|
||||
return(GETDNS_RETURN_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
/* Set up the getdns_sync_request call */
|
||||
const char * this_name = "www.example.com";
|
||||
uint8_t this_request_type = GETDNS_RRTYPE_A;
|
||||
/* Get the A and AAAA records */
|
||||
struct getdns_dict * this_extensions = getdns_dict_create();
|
||||
this_extensions = getdns_dict_create();
|
||||
this_ret = getdns_dict_set_int(this_extensions, "return_both_v4_and_v6", GETDNS_EXTENSION_TRUE);
|
||||
if (this_ret != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
fprintf(stderr, "Trying to set an extension do both IPv4 and IPv6 failed: %d", this_ret);
|
||||
return(GETDNS_RETURN_GENERIC_ERROR);
|
||||
}
|
||||
uint32_t this_response_length;
|
||||
struct getdns_dict * this_response = NULL;
|
||||
|
||||
/* Make the call */
|
||||
getdns_return_t dns_request_return = getdns_general_sync(this_context, this_name, this_request_type,
|
||||
|
@ -41,33 +79,31 @@ int main()
|
|||
else
|
||||
{
|
||||
/* Be sure the search returned something */
|
||||
uint32_t * this_error = NULL;
|
||||
this_ret = getdns_dict_get_int(this_response, "status", this_error); // Ignore any error
|
||||
if (this_error && (*this_error != GETDNS_RESPSTATUS_GOOD)) // If the search didn't return "good"
|
||||
{
|
||||
fprintf(stderr, "The search had no results, and a return value of %d. Exiting.", *this_error);
|
||||
return(GETDNS_RETURN_GENERIC_ERROR);
|
||||
}
|
||||
struct getdns_list * just_the_addresses_ptr;
|
||||
this_ret = getdns_dict_get_list(this_response, "just_address_answers", &just_the_addresses_ptr); // Ignore any error
|
||||
size_t * num_addresses_ptr = NULL;
|
||||
this_ret = getdns_list_get_length(just_the_addresses_ptr, num_addresses_ptr); // Ignore any error
|
||||
/* Go through each record */
|
||||
if (num_addresses_ptr) {
|
||||
for ( size_t rec_count = 0; rec_count <= *num_addresses_ptr; ++rec_count )
|
||||
for (rec_count = 0; rec_count <= *num_addresses_ptr; ++rec_count )
|
||||
{
|
||||
struct getdns_dict * this_address;
|
||||
this_ret = getdns_list_get_dict(just_the_addresses_ptr, rec_count, &this_address); // Ignore any error
|
||||
/* Just print the address */
|
||||
struct getdns_bindata * this_address_data;
|
||||
this_ret = getdns_dict_get_bindata(this_address, "address_data", &this_address_data); // Ignore any error
|
||||
printf("The address is %s", getdns_display_ip_address(this_address_data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
getdns_context_destroy(this_context);
|
||||
getdns_free_sync_request_memory(this_response);
|
||||
/* Assuming we get here, leave gracefully */
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
} /* main */
|
||||
|
||||
/* example-synchronous.c */
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* getdns_core_only.c
|
||||
*/
|
||||
|
||||
#include <getdns_libevent.h>
|
||||
|
||||
/* stuff to make it compile pedantically */
|
||||
|
@ -401,3 +404,4 @@ getdns_extension_set_libevent_base(
|
|||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(this_event_base); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
/* getdns_core_only.c */
|
||||
|
|
2182
src/src/index.html
2182
src/src/index.html
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue