GNUnet  0.10.x
Macros | Typedefs | Functions | Variables
w32nsp-resolve.c File Reference

W32 integration for GNS. More...

#include <ws2tcpip.h>
#include <windows.h>
#include <nspapi.h>
#include <ws2spi.h>
#include <initguid.h>
#include "gnunet_w32nsp_lib.h"
#include <stdio.h>
Include dependency graph for w32nsp-resolve.c:

Go to the source code of this file.

Macros

#define GNUNET_memcpy(dst, src, n)   do { if (0 != n) { (void)memcpy(dst, src, n); } } while (0)
 
#define DEFINE_DNS_GUID(a, x)   DEFINE_GUID(a, 0x00090035, 0x0000, x, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 

Typedefs

typedef int(WSPAPI * LPNSPSTARTUP) (LPGUID lpProviderId, LPNSP_ROUTINE lpnspRoutines)
 

Functions

 DEFINE_GUID (W32_DNS, 0x22059D40, 0x7E9E, 0x11CF, 0xAE, 0x5A, 0x00, 0xAA, 0x00, 0xA7, 0x11, 0x2B)
 
 DEFINE_GUID (SVCID_DNS_TYPE_A, 0x00090035, 0x0000, 0x0001, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_NS, 0x00090035, 0x0000, 0x0002, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_CNAME, 0x00090035, 0x0000, 0x0005, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_SOA, 0x00090035, 0x0000, 0x0006, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_PTR, 0x00090035, 0x0000, 0x000c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_MX, 0x00090035, 0x0000, 0x000f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_TEXT, 0x00090035, 0x0000, 0x0010, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_AAAA, 0x00090035, 0x0000, 0x001c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_SRV, 0x00090035, 0x0000, 0x0021, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_HOSTNAME, 0x0002a800, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_INET_HOSTADDRBYNAME, 0x0002a803, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
VOID FixList (PCHAR **List, PCHAR Base)
 
VOID UnpackHostEnt (struct hostent *hostent)
 
static void print_hostent (struct hostent *he)
 
int main (int argc, char **argv)
 

Variables

GUID host = { 0x0002a800, 0, 0, { 0xC0, 0, 0, 0, 0, 0, 0, 0x46 } }
 
GUID ip4 = { 0x00090035, 0, 1, { 0xc0, 0, 0, 0, 0, 0, 0, 0x046 } }
 
GUID ip6 = { 0x00090035, 0, 0x001c, { 0xc0, 0, 0, 0, 0, 0, 0, 0x046 } }
 

Detailed Description

W32 integration for GNS.

Author
LRN

Definition in file w32nsp-resolve.c.

Macro Definition Documentation

◆ GNUNET_memcpy

#define GNUNET_memcpy (   dst,
  src,
 
)    do { if (0 != n) { (void)memcpy(dst, src, n); } } while (0)

Definition at line 26 of file w32nsp-resolve.c.

Referenced by ack_proc(), add_address_to_uri(), add_attribute_cont(), add_dns_result(), add_record(), add_to_keyword_counter(), add_to_tc(), address_notification(), adv_transmit(), aes_128_cbc_decrypt(), aes_128_cbc_encrypt(), announce_id(), announce_reconnect(), api_connect(), api_create_hello(), api_send(), attempt_read_stdin(), attempt_read_tap(), attr_iter_cb(), automaton_create_proofs_simplify(), backward_resolution(), block_create(), block_reader(), broadcast_status(), buffer_append(), buffer_init(), build_dns_query(), callback_download(), change_service(), check_crc_buf_osdep(), check_local_data(), check_n_peers_ready(), check_notify_client(), check_peer_info_ready(), check_proof_of_work(), client_response_handler(), client_schedule(), client_send_cb(), compose_address_iterate_response_message(), conclude_autoconfig_request(), connect_probe_continuation(), consider_for_advertising(), consume_ticket_cont(), create_address(), create_ats_address(), create_response(), create_session(), create_set_default_message(), create_update_message(), credential_to_json(), credential_value_to_string(), curl_check_hdr(), curl_download_cb(), curl_upload_cb(), database_setup(), decode_and_send(), delegation_chain_resolution_start(), dht_get_string_handler(), discard_hosts_helper(), dispatch_buffer(), dns_pre_request_handler(), dns_string_to_value(), do_restart_typemap_message(), do_round(), do_transmit(), download_cb(), ego_create(), ego_edit(), ego_edit_subsystem(), enqueue_fragment(), EnumNICs3(), execute_add(), extract_files(), extract_fixed_blob(), extract_var_blob(), extract_varsize_blob(), file_in_send(), find_full_data(), find_proof(), find_subsystem_entry(), format_help(), forward_dv_learn(), forward_reply(), GCCH_handle_channel_plaintext_data(), GCCH_handle_local_data(), GCD_search(), GDS_CLIENTS_process_get(), GDS_CLIENTS_process_get_resp(), GDS_CLIENTS_process_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), GDS_ROUTING_add(), get_channel_key_from_ips(), get_existing_record(), get_fair_encryption_challenge(), get_hello_address_size(), get_identity(), get_ip_from_hostname(), get_label(), get_server_addresses(), getopt_set_keywords(), getPRK(), gns_string_to_value(), gns_value_to_string(), GNUNET_BIO_read(), GNUNET_BIO_write(), GNUNET_CONFIGURATION_expand_dollar(), GNUNET_CONFIGURATION_serialize(), GNUNET_CONNECTION_connect_socket(), GNUNET_CONNECTION_create_from_accept(), GNUNET_CONNECTION_get_address(), GNUNET_CONSENSUS_create(), GNUNET_CONSENSUS_insert(), GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_CONTAINER_meta_data_deserialize(), GNUNET_CONTAINER_meta_data_get_thumbnail(), GNUNET_CONTAINER_meta_data_insert(), GNUNET_CONTAINER_meta_data_serialize(), GNUNET_copy_message(), GNUNET_CREDENTIAL_collect(), GNUNET_CREDENTIAL_credential_deserialize(), GNUNET_CREDENTIAL_credential_from_string(), GNUNET_CREDENTIAL_credential_issue(), GNUNET_CREDENTIAL_credential_serialize(), GNUNET_CREDENTIAL_credentials_deserialize(), GNUNET_CREDENTIAL_credentials_serialize(), GNUNET_CREDENTIAL_delegation_chain_deserialize(), GNUNET_CREDENTIAL_delegation_chain_serialize(), GNUNET_CREDENTIAL_delegation_set_deserialize(), GNUNET_CREDENTIAL_delegation_set_serialize(), GNUNET_CREDENTIAL_verify(), GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hkdf_v(), GNUNET_CRYPTO_hmac_raw(), GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_symmetric_derive_iv_v(), GNUNET_DATASTORE_put(), GNUNET_DATASTORE_remove(), GNUNET_DEFRAGMENT_process_fragment(), GNUNET_DHT_get_filter_known_results(), GNUNET_DHT_get_start(), GNUNET_DHT_put(), GNUNET_DNS_request_answer(), GNUNET_DNSPARSER_builder_add_cert(), GNUNET_DNSPARSER_builder_add_mx(), GNUNET_DNSPARSER_builder_add_name(), GNUNET_DNSPARSER_builder_add_query(), GNUNET_DNSPARSER_builder_add_soa(), GNUNET_DNSPARSER_builder_add_srv(), GNUNET_DNSPARSER_pack(), GNUNET_DNSPARSER_parse_cert(), GNUNET_DNSPARSER_parse_mx(), GNUNET_DNSPARSER_parse_query(), GNUNET_DNSPARSER_parse_record(), GNUNET_DNSPARSER_parse_soa(), GNUNET_DNSPARSER_parse_srv(), GNUNET_DNSSTUB_add_dns_sa(), GNUNET_FRAGMENT_context_create(), GNUNET_FS_add_to_index(), GNUNET_FS_data_reader_copy_(), GNUNET_FS_directory_builder_add(), GNUNET_FS_directory_builder_finish(), GNUNET_FS_directory_list_contents(), GNUNET_FS_indexing_send_list(), GNUNET_FS_publish_ublock_(), GNUNET_FS_uri_dup(), GNUNET_GNS_lookup(), GNUNET_GNSRECORD_block_decrypt(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_records_serialize(), GNUNET_HELLO_add_address(), GNUNET_HELLO_address_allocate(), GNUNET_HELLO_create(), GNUNET_HELLO_iterate_addresses(), GNUNET_HELPER_send(), GNUNET_IDENTITY_create(), GNUNET_IDENTITY_delete(), GNUNET_IDENTITY_get(), GNUNET_IDENTITY_rename(), GNUNET_IDENTITY_set(), GNUNET_MQ_copy_handlers(), GNUNET_MQ_copy_handlers2(), GNUNET_MQ_msg_copy(), GNUNET_MQ_msg_nested_mh_(), GNUNET_MQ_send_copy(), GNUNET_MST_from_buffer(), GNUNET_NAMECACHE_block_cache(), GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_records_store(), GNUNET_NAT_AUTO_autoconfig_start(), GNUNET_NAT_register(), GNUNET_NAT_request_reversal(), GNUNET_NAT_stun_handle_packet(), GNUNET_NETWORK_fdset_copy(), GNUNET_NETWORK_socket_bind(), GNUNET_PROGRAM_run2(), GNUNET_RECLAIM_ATTRIBUTE_claim_new(), GNUNET_RECLAIM_ATTRIBUTE_deserialize(), GNUNET_RECLAIM_ATTRIBUTE_serialize(), GNUNET_RESOLVER_hostname_get(), GNUNET_RESOLVER_ip_get(), GNUNET_REVOCATION_check_pow(), GNUNET_RPS_seed_ids(), GNUNET_SCALARPRODUCT_accept_computation(), GNUNET_SCALARPRODUCT_start_computation(), GNUNET_SECRETSHARING_create_session(), GNUNET_SECRETSHARING_share_read(), GNUNET_SECRETSHARING_share_write(), GNUNET_SERVER_mst_receive(), GNUNET_SET_add_element(), GNUNET_SET_element_dup(), GNUNET_SET_remove_element(), GNUNET_SOCKS_set_handshake_destination(), GNUNET_STRINGS_buffer_fill(), GNUNET_STRINGS_conv(), GNUNET_STRINGS_parse_uri(), GNUNET_STRINGS_to_address_ipv6(), GNUNET_STRINGS_utf8_tolower(), GNUNET_STRINGS_utf8_toupper(), GNUNET_TESTBED_barrier_cancel(), GNUNET_TESTBED_barrier_init_(), GNUNET_TESTBED_barrier_wait(), GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_create_helper_init_msg_(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTBED_hosts_load_from_file(), GNUNET_TESTBED_LOGGER_write(), GNUNET_TESTBED_operation_inactivate_(), GNUNET_TESTBED_queue_message_(), GNUNET_TESTBED_register_host(), GNUNET_TESTING_get_testname_from_underscore(), GNUNET_TESTING_hostkey_get(), GNUNET_TESTING_peer_get_identity(), GNUNET_TRANSPORT_address_to_string(), GNUNET_TRANSPORT_core_connect(), GNUNET_TRANSPORT_core_get_mq(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TUN_compute_service_cadet_port(), GNUNET_VPN_redirect_to_ip(), GNUNET_W32NSP_LookupServiceNext(), GNUNET_xfree_(), GNUNET_xgrow_(), GNUNET_xmemdup_(), GNUNET_xstrdup_(), GNUNET_xstrndup_(), GSC_CLIENTS_deliver_message(), GSC_KX_encrypt_and_transmit(), GSC_SESSIONS_transmit(), GSC_TYPEMAP_compute_type_map_message(), GSC_TYPEMAP_extend(), GSC_TYPEMAP_get_from_message(), GSF_dht_lookup_(), GSF_pending_request_create_(), GSF_pending_request_get_message_(), GSF_pending_request_update_(), GST_manipulation_send(), GST_neighbours_send(), GST_send_operation_fail_msg(), GST_validation_handle_ping(), handle_add_host(), handle_address_change_notification(), handle_alice_client_message(), handle_alice_client_message_multipart(), handle_alices_cryptodata_message(), handle_barrier_cancel(), handle_barrier_init(), handle_barrier_status(), handle_barrier_wait(), handle_block_cache(), handle_bob_client_message(), handle_bob_client_message_multipart(), handle_bobs_cryptodata_message(), handle_bobs_cryptodata_multipart(), handle_cadet_audio_message(), handle_client_audio_message(), handle_client_insert(), handle_client_redirect_to_ip(), handle_client_response(), handle_collect(), handle_data(), handle_datastore_reply(), handle_dht_local_get(), handle_dht_local_get_result_seen(), handle_dht_local_monitor(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_dns_request(), handle_gns2dns_ip(), handle_gns2dns_result(), handle_gns_resolution_result(), handle_gns_response(), handle_gns_result(), handle_icmp_back(), handle_intersection_p2p_bf(), handle_link_controllers_result(), handle_lookup_block_it(), handle_lookup_block_response(), handle_p2p_reply(), handle_peer_config(), handle_peer_get_config(), handle_record_lookup(), handle_record_store(), handle_register(), handle_remote_overlay_connect(), handle_request(), handle_request_connection_reversal(), handle_search_result(), handle_set(), handle_slave_get_config(), handle_stream_input(), handle_stun(), handle_tcp_back(), handle_tcp_nat_probe(), handle_tcp_welcome(), handle_udp_back(), handle_union_p2p_demand(), handle_union_p2p_elements(), handle_union_p2p_full_element(), handle_union_p2p_offer(), handle_verify(), handle_watch(), handle_zone_to_name_it(), handler_advertisement(), hash_for_index_cb(), hash_pkey_and_label(), hash_redirect_info(), heap_plugin_put(), hello_update_cb(), host_habitable_cb(), host_processor(), http_client_plugin_send(), http_common_address_from_socket(), http_common_plugin_address_to_string(), http_common_plugin_address_to_url(), http_common_plugin_dnsresult_to_address(), http_common_plugin_string_to_address(), http_server_plugin_send(), ibf_read_slice(), ibf_write_slice(), icmp_from_helper(), idx_of(), iface_proc(), ifc_proc(), init_aes(), initialize_session_peer_list(), interface_proc(), iterate_cb(), json_to_credential(), LEGACY_SERVICE_get_server_addresses(), LEGACY_SERVICE_start(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_unix_done(), linux_read(), load_hostlist_file(), login_cont(), lookup_nick_it(), mac_set(), main(), make_file(), make_info_message(), make_peer(), merge_with_nick_records(), mhd_content_cb(), move_children(), mst_receive(), namecache_cache_block(), namestore_add(), namestore_flat_store_records(), namestore_postgres_store_records(), namestore_sqlite_store_records(), normalize_metadata(), normalize_peers(), notify_client(), notify_clients_stun_change(), notify_listeners(), notify_send_probe(), ogg_init(), on_appsink_new_sample(), open_device(), open_device_raw(), opstart_manage_service(), opstart_peer_create(), opstart_peer_reconfigure(), packetizer(), PEERSTORE_create_record_mq_envelope(), peerstore_flat_store_record(), PEERSTORE_hash_key(), PEERSTORE_parse_record_message(), play(), plugin_session_info_cb(), post_iterator(), prepare_beacon(), prepare_ipv4_packet(), prepare_ipv6_packet(), print_key(), process_dns_result(), process_external_ip(), process_header(), process_hello(), process_helper_messages(), process_lookup_result(), process_migration_content(), process_payload(), process_reply_with_path(), process_requests(), put_cb(), queue(), read_cpabe(), read_from_the_socket(), read_index_list(), read_process_fragment(), read_stdio(), reciever(), record(), recursive_pkey_resolution(), regex_add_multiple(), REGEX_BLOCK_create(), remove_epsilon(), request_done(), resize_records(), result_processor(), reversal_callback(), revoke_ticket_cont(), ril_cut_from_vector(), route_packet(), run(), sb_append(), sb_append_cstr(), sb_realloc(), sb_strdup(), sb_strdup_cstr(), search_reconnect(), send_ack(), send_add_address_message(), send_add_session_message(), send_bloomfilter(), send_client_element(), send_client_removed_element(), send_client_reply(), send_client_status_msg(), send_controller_link_response(), send_full_element_iterator(), send_get(), send_get_known_results(), send_hello_beacon(), send_hello_thru_rocc(), send_icmp_packet_via_tun(), send_lookup_response(), send_mac_to_plugin(), send_missing_full_elements_iter(), send_name_to_ip_request(), send_pull_reply(), send_push(), send_remaining_elements(), send_reply(), send_request(), send_request_to_client(), send_result_code(), send_stream_peers(), send_to_client_iter(), send_view(), server_get_addresses(), server_notify_external_hostname(), server_send_callback(), service_task(), set_cont(), stdin_receiver(), stdin_send(), stdin_send_hw(), store_all_states(), strata_estimator_write(), stream_read_callback(), t_hmac(), tcp_from_helper(), tcp_nat_port_map_callback(), tcp_plugin_address_pretty_printer(), tcp_plugin_address_to_string(), tcp_plugin_get_network_for_address(), tcp_plugin_get_session(), tcp_plugin_send(), tmt_rdy_pong(), transmit_address_to_client(), transmit_bobs_cryptodata_message(), transmit_bobs_cryptodata_message_multipart(), transmit_call_audio(), transmit_client_response(), transmit_content(), transmit_fragment(), transmit_item(), transmit_next(), transmit_phone_audio(), transmit_ping_if_allowed(), transmit_ready(), transmit_req_addr(), transmit_status(), try_connect_using_address(), try_transmission(), udp_from_helper(), udp_plugin_get_network_for_address(), udp_plugin_send(), union_accept(), unix_address_to_sockaddr(), unix_plugin_do_read(), unix_plugin_send(), unix_plugin_string_to_address(), update_hello(), uri_chk_parse(), uri_loc_parse(), verify_cred_cont(), view_update_cb(), vpn_allocation_callback(), wlan_plugin_send(), write_cpabe(), and write_page().

◆ DEFINE_DNS_GUID

#define DEFINE_DNS_GUID (   a,
 
)    DEFINE_GUID(a, 0x00090035, 0x0000, x, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)

Definition at line 45 of file w32nsp-resolve.c.

Typedef Documentation

◆ LPNSPSTARTUP

typedef int(WSPAPI * LPNSPSTARTUP) (LPGUID lpProviderId, LPNSP_ROUTINE lpnspRoutines)

Definition at line 37 of file w32nsp-resolve.c.

Function Documentation

◆ DEFINE_GUID() [1/12]

DEFINE_GUID ( W32_DNS  ,
0x22059D40  ,
0x7E9E  ,
0x11CF  ,
0xAE  ,
0x5A  ,
0x00  ,
0xAA  ,
0x00  ,
0xA7  ,
0x11  ,
0x2B   
)

◆ DEFINE_GUID() [2/12]

DEFINE_GUID ( SVCID_DNS_TYPE_A  ,
0x00090035  ,
0x0000  ,
0x0001  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [3/12]

DEFINE_GUID ( SVCID_DNS_TYPE_NS  ,
0x00090035  ,
0x0000  ,
0x0002  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [4/12]

DEFINE_GUID ( SVCID_DNS_TYPE_CNAME  ,
0x00090035  ,
0x0000  ,
0x0005  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [5/12]

DEFINE_GUID ( SVCID_DNS_TYPE_SOA  ,
0x00090035  ,
0x0000  ,
0x0006  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [6/12]

DEFINE_GUID ( SVCID_DNS_TYPE_PTR  ,
0x00090035  ,
0x0000  ,
0x000c  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [7/12]

DEFINE_GUID ( SVCID_DNS_TYPE_MX  ,
0x00090035  ,
0x0000  ,
0x000f  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [8/12]

DEFINE_GUID ( SVCID_DNS_TYPE_TEXT  ,
0x00090035  ,
0x0000  ,
0x0010  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [9/12]

DEFINE_GUID ( SVCID_DNS_TYPE_AAAA  ,
0x00090035  ,
0x0000  ,
0x001c  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [10/12]

DEFINE_GUID ( SVCID_DNS_TYPE_SRV  ,
0x00090035  ,
0x0000  ,
0x0021  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [11/12]

DEFINE_GUID ( SVCID_HOSTNAME  ,
0x0002a800  ,
0x0000  ,
0x0000  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [12/12]

DEFINE_GUID ( SVCID_INET_HOSTADDRBYNAME  ,
0x0002a803  ,
0x0000  ,
0x0000  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ FixList()

VOID FixList ( PCHAR **  List,
PCHAR  Base 
)

Definition at line 64 of file w32nsp-resolve.c.

Referenced by UnpackHostEnt().

65 {
66  if (*List)
67  {
68  PCHAR * Addr;
69 
70  Addr = *List = (PCHAR *)(((DWORD)*List + Base));
71  while (*Addr)
72  {
73  *Addr = (PCHAR)(((DWORD)*Addr + Base));
74  Addr++;
75  }
76  }
77 }
Here is the caller graph for this function:

◆ UnpackHostEnt()

VOID UnpackHostEnt ( struct hostent *  hostent)

Definition at line 85 of file w32nsp-resolve.c.

References FixList(), and pch.

Referenced by main().

86 {
87  PCHAR pch;
88 
89  pch = (PCHAR)hostent;
90 
91  if (hostent->h_name)
92  {
93  hostent->h_name = (PCHAR)((DWORD)hostent->h_name + pch);
94  }
95  FixList(&hostent->h_aliases, pch);
96  FixList(&hostent->h_addr_list, pch);
97 }
static struct GNUNET_SCHEDULER_Task * pch
Handle for the parent_control_handler() Task.
Definition: os_priority.c:66
VOID FixList(PCHAR **List, PCHAR Base)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_hostent()

static void print_hostent ( struct hostent *  he)
static

Definition at line 101 of file w32nsp-resolve.c.

References buf.

Referenced by main().

102 {
103  int i;
104  char **pAlias;
105 
106  printf("\tOfficial name: %s\n", he->h_name);
107  for (i = 0, pAlias = he->h_aliases; *pAlias != 0; pAlias++)
108  {
109  printf("\tAlternate name #%d: %s\n", ++i, *pAlias);
110  }
111  printf("\tAddress type: ");
112  switch (he->h_addrtype)
113  {
114  case AF_INET:
115  printf("AF_INET\n");
116  break;
117 
118  case AF_INET6:
119  printf("AF_INET6\n");
120  break;
121 
122  case AF_NETBIOS:
123  printf("AF_NETBIOS\n");
124  break;
125 
126  default:
127  printf(" %d\n", he->h_addrtype);
128  break;
129  }
130  printf("\tAddress length: %d\n", he->h_length);
131 
132  if (he->h_addrtype == AF_INET)
133  {
134  struct sockaddr_in addr;
135  memset(&addr, 0, sizeof(addr));
136  addr.sin_family = AF_INET;
137  addr.sin_port = 0;
138  i = 0;
139  while (he->h_addr_list[i] != 0)
140  {
141  char buf[1024];
142  DWORD buflen = 1024;
143  addr.sin_addr = *(struct in_addr *)he->h_addr_list[i++];
144  if (NO_ERROR == WSAAddressToStringA((LPSOCKADDR)&addr, sizeof(addr), NULL, buf, &buflen))
145  printf("\tIPv4 Address #%d: %s\n", i, buf);
146  else
147  printf("\tIPv4 Address #%d: Can't convert: %lu\n", i, GetLastError());
148  }
149  }
150  else if (he->h_addrtype == AF_INET6)
151  {
152  struct sockaddr_in6 addr;
153  memset(&addr, 0, sizeof(addr));
154  addr.sin6_family = AF_INET6;
155  addr.sin6_port = 0;
156  i = 0;
157  while (he->h_addr_list[i] != 0)
158  {
159  char buf[1024];
160  DWORD buflen = 1024;
161  addr.sin6_addr = *(struct in6_addr *)he->h_addr_list[i++];
162  if (NO_ERROR == WSAAddressToStringA((LPSOCKADDR)&addr, sizeof(addr), NULL, buf, &buflen))
163  printf("\tIPv6 Address #%d: %s\n", i, buf);
164  else
165  printf("\tIPv6 Address #%d: Can't convert: %lu\n", i, GetLastError());
166  }
167  }
168 }
static char buf[2048]
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 172 of file w32nsp-resolve.c.

References buf, GNUNET_memcpy, print_hostent(), result, ret, sc, and UnpackHostEnt().

173 {
174  int ret;
175  int r = 1;
176  WSADATA wsd;
177  GUID prov;
178  GUID sc;
179  wchar_t *cmdl;
180  int wargc;
181  wchar_t **wargv;
182 
183  if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0)
184  {
185  fprintf(stderr, "WSAStartup() failed: %lu\n", GetLastError());
186  return 5;
187  }
188 
189  cmdl = GetCommandLineW();
190  if (cmdl == NULL)
191  {
192  WSACleanup();
193  return 2;
194  }
195  wargv = CommandLineToArgvW(cmdl, &wargc);
196  if (wargv == NULL)
197  {
198  WSACleanup();
199  return 3;
200  }
201  r = 4;
202 
203  if (wargc == 5)
204  {
205  if (wcscmp(wargv[1], L"A") == 0)
206  sc = SVCID_DNS_TYPE_A;
207  else if (wcscmp(wargv[1], L"AAAA") == 0)
208  sc = SVCID_DNS_TYPE_AAAA;
209  else if (wcscmp(wargv[1], L"name") == 0)
210  sc = SVCID_HOSTNAME;
211  else if (wcscmp(wargv[1], L"addr") == 0)
212  sc = SVCID_INET_HOSTADDRBYNAME;
213  else
214  wargc -= 1;
215  if (wcscmp(wargv[4], L"mswdns") == 0)
216  prov = W32_DNS;
217  else if (wcscmp(wargv[4], L"gnunetdns") == 0)
218  prov = GNUNET_NAMESPACE_PROVIDER_DNS;
219  else
220  wargc -= 1;
221  }
222  else if (wargc == 3)
223  {
224  }
225  else
226  {
227  fprintf(stderr, "Usage: %S <record type> <service name> <NSP library path> <NSP id>\n"
228  "record type - one of the following: A | AAAA | name | addr\n"
229  "service name - a string to resolve; \" \" (a space) means 'blank'\n"
230  "NSP library path - path to libw32nsp\n"
231  "NSP id - one of the following: mswdns | gnunetdns\n",
232  wargv[0]);
233  }
234 
235  if (wargc == 5)
236  {
237  HMODULE nsp;
238 
239  nsp = LoadLibraryW(wargv[3]);
240  if (nsp == NULL)
241  {
242  fprintf(stderr, "Failed to load library `%S'\n", wargv[3]);
243  }
244  else
245  {
246  LPNSPSTARTUP startup = (LPNSPSTARTUP)GetProcAddress(nsp, "NSPStartup");
247  if (startup == NULL)
248  startup = (LPNSPSTARTUP)GetProcAddress(nsp, "NSPStartup@8");
249  if (startup != NULL)
250  {
251  NSP_ROUTINE api;
252  api.cbSize = sizeof(api);
253  ret = startup(&prov, &api);
254  if (NO_ERROR != ret)
255  fprintf(stderr, "startup failed: %lu\n", GetLastError());
256  else
257  {
258  HANDLE lookup;
259  WSAQUERYSETW search;
260  char buf[4096];
261  WSAQUERYSETW *result = (WSAQUERYSETW *)buf;
262  DWORD resultsize;
263  DWORD err;
264  memset(&search, 0, sizeof(search));
265  search.dwSize = sizeof(search);
266  search.lpszServiceInstanceName = (wcscmp(wargv[2], L" ") == 0) ? NULL : wargv[2];
267  search.lpServiceClassId = &sc;
268  search.lpNSProviderId = &prov;
269  search.dwNameSpace = NS_ALL;
270  ret = api.NSPLookupServiceBegin(&prov, &search, NULL, LUP_RETURN_ALL, &lookup);
271  if (ret != NO_ERROR)
272  {
273  fprintf(stderr, "lookup start failed\n");
274  }
275  else
276  {
277  resultsize = 4096;
278  ret = api.NSPLookupServiceNext(lookup, LUP_RETURN_ALL, &resultsize, result);
279  err = GetLastError();
280  if (ret != NO_ERROR)
281  {
282  fprintf(stderr, "lookup next failed: %lu\n", err);
283  }
284  else
285  {
286  int i;
287  printf("Got result:\n");
288  printf(" lpszServiceInstanceName: %S\n", result->lpszServiceInstanceName ? result->lpszServiceInstanceName : L"NULL");
289  if (result->lpServiceClassId)
290  printf(" lpServiceClassId: { 0x%08lX,0x%04X,0x%04X, { 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X } }\n",
291  result->lpServiceClassId->Data1, result->lpServiceClassId->Data2, result->lpServiceClassId->Data3, result->lpServiceClassId->Data4[0],
292  result->lpServiceClassId->Data4[1], result->lpServiceClassId->Data4[2], result->lpServiceClassId->Data4[3], result->lpServiceClassId->Data4[4],
293  result->lpServiceClassId->Data4[5], result->lpServiceClassId->Data4[6], result->lpServiceClassId->Data4[7]);
294  else
295  printf(" lpServiceClassId: NULL\n");
296  if (result->lpVersion)
297  printf(" lpVersion: 0x%08lX, %d\n", result->lpVersion->dwVersion, result->lpVersion->ecHow);
298  else
299  printf(" lpVersion: NULL\n");
300  printf(" lpszComment: %S\n", result->lpszComment ? result->lpszComment : L"NULL");
301  printf(" dwNameSpace: %lu\n", result->dwNameSpace);
302  if (result->lpNSProviderId)
303  printf(" lpNSProviderId: { 0x%08lX,0x%04X,0x%04X, { 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X } }\n",
304  result->lpNSProviderId->Data1, result->lpNSProviderId->Data2, result->lpNSProviderId->Data3, result->lpNSProviderId->Data4[0],
305  result->lpNSProviderId->Data4[1], result->lpNSProviderId->Data4[2], result->lpNSProviderId->Data4[3], result->lpNSProviderId->Data4[4],
306  result->lpNSProviderId->Data4[5], result->lpNSProviderId->Data4[6], result->lpNSProviderId->Data4[7]);
307  else
308  printf(" lpNSProviderId: NULL\n");
309  printf(" lpszContext: %S\n", result->lpszContext ? result->lpszContext : L"NULL");
310  printf(" dwNumberOfProtocols: %lu\n", result->dwNumberOfProtocols);
311  printf(" lpszQueryString: %S\n", result->lpszQueryString ? result->lpszQueryString : L"NULL");
312  printf(" dwNumberOfCsAddrs: %lu\n", result->dwNumberOfCsAddrs);
313  for (i = 0; i < result->dwNumberOfCsAddrs; i++)
314  {
315  switch (result->lpcsaBuffer[i].iSocketType)
316  {
317  case SOCK_STREAM:
318  printf(" %d: iSocketType = SOCK_STREAM\n", i);
319  break;
320 
321  case SOCK_DGRAM:
322  printf(" %d: iSocketType = SOCK_DGRAM\n", i);
323  break;
324 
325  default:
326  printf(" %d: iSocketType = %d\n", i, result->lpcsaBuffer[i].iSocketType);
327  }
328  switch (result->lpcsaBuffer[i].iProtocol)
329  {
330  case IPPROTO_TCP:
331  printf(" %d: iProtocol = IPPROTO_TCP\n", i);
332  break;
333 
334  case IPPROTO_UDP:
335  printf(" %d: iProtocol = IPPROTO_UDP\n", i);
336  break;
337 
338  default:
339  printf(" %d: iProtocol = %d\n", i, result->lpcsaBuffer[i].iProtocol);
340  }
341  switch (result->lpcsaBuffer[i].LocalAddr.lpSockaddr->sa_family)
342  {
343  case AF_INET:
344  printf(" %d: loc family = AF_INET\n", i);
345  break;
346 
347  case AF_INET6:
348  printf(" %d: loc family = AF_INET6\n", i);
349  break;
350 
351  default:
352  printf(" %d: loc family = %hu\n", i, result->lpcsaBuffer[i].LocalAddr.lpSockaddr->sa_family);
353  }
354  switch (result->lpcsaBuffer[i].RemoteAddr.lpSockaddr->sa_family)
355  {
356  case AF_INET:
357  printf(" %d: rem family = AF_INET\n", i);
358  break;
359 
360  case AF_INET6:
361  printf(" %d: rem family = AF_INET6\n", i);
362  break;
363 
364  default:
365  printf(" %d: rem family = %hu\n", i, result->lpcsaBuffer[i].RemoteAddr.lpSockaddr->sa_family);
366  }
367  char buf[1024];
368  DWORD buflen = 1024;
369  if (NO_ERROR == WSAAddressToStringA(result->lpcsaBuffer[i].LocalAddr.lpSockaddr, result->lpcsaBuffer[i].LocalAddr.iSockaddrLength, NULL, buf, &buflen))
370  printf("\tLocal Address #%d: %s\n", i, buf);
371  else
372  printf("\tLocal Address #%d: Can't convert: %lu\n", i, GetLastError());
373  buflen = 1024;
374  if (NO_ERROR == WSAAddressToStringA(result->lpcsaBuffer[i].RemoteAddr.lpSockaddr, result->lpcsaBuffer[i].RemoteAddr.iSockaddrLength, NULL, buf, &buflen))
375  printf("\tRemote Address #%d: %s\n", i, buf);
376  else
377  printf("\tRemote Address #%d: Can't convert: %lu\n", i, GetLastError());
378  }
379  printf(" dwOutputFlags: 0x%08lX\n", result->dwOutputFlags);
380  printf(" lpBlob: 0x%p\n", result->lpBlob);
381  if (result->lpBlob)
382  {
383  struct hostent *he = malloc(result->lpBlob->cbSize);
384  if (he != NULL)
385  {
386  GNUNET_memcpy(he, result->lpBlob->pBlobData, result->lpBlob->cbSize);
387  UnpackHostEnt(he);
388  print_hostent(he);
389  free(he);
390  }
391  }
392  }
393  ret = api.NSPLookupServiceEnd(lookup);
394  if (ret != NO_ERROR)
395  printf("NSPLookupServiceEnd() failed: %lu\n", GetLastError());
396  }
397  api.NSPCleanup(&prov);
398  }
399  }
400  FreeLibrary(nsp);
401  }
402  }
403  else if (wargc == 3)
404  {
405  int s;
406  ADDRINFOW hints;
407  ADDRINFOW *result;
408  ADDRINFOW *pos;
409 
410  memset(&hints, 0, sizeof(struct addrinfo));
411  hints.ai_family = AF_UNSPEC;
412  hints.ai_socktype = SOCK_STREAM;
413 
414  if (0 != (s = GetAddrInfoW(wargv[2], NULL, &hints, &result)))
415  {
416  fprintf(stderr, "Cound not resolve `%S' using GetAddrInfoW: %lu\n",
417  wargv[2], GetLastError());
418  }
419  else
420  {
421  for (pos = result; pos != NULL; pos = pos->ai_next)
422  {
423  wchar_t tmpbuf[1024];
424  DWORD buflen = 1024;
425  if (0 == WSAAddressToStringW(pos->ai_addr, pos->ai_addrlen, NULL, tmpbuf, &buflen))
426  fprintf(stderr, "Result:\n"
427  " flags: 0x%X\n"
428  " family: 0x%X\n"
429  " socktype: 0x%X\n"
430  " protocol: 0x%X\n"
431  " addrlen: %u\n"
432  " addr: %S\n"
433  " canonname: %S\n",
434  pos->ai_flags,
435  pos->ai_family,
436  pos->ai_socktype,
437  pos->ai_protocol,
438  pos->ai_addrlen,
439  tmpbuf,
440  pos->ai_canonname);
441  else
442  fprintf(stderr, "Result:\n"
443  " flags: 0x%X\n"
444  " family: 0x%X\n"
445  " socktype: 0x%X\n"
446  " protocol: 0x%X\n"
447  " addrlen: %u\n"
448  " addr: %S\n"
449  " canonname: %S\n",
450  pos->ai_flags,
451  pos->ai_family,
452  pos->ai_socktype,
453  pos->ai_protocol,
454  pos->ai_addrlen,
455  L"<can't stringify>",
456  pos->ai_canonname);
457  }
458  if (NULL != result)
459  FreeAddrInfoW(result);
460  }
461  }
462  WSACleanup();
463  return r;
464 }
int(WSPAPI * LPNSPSTARTUP)(LPGUID lpProviderId, LPNSP_ROUTINE lpnspRoutines)
static void print_hostent(struct hostent *he)
static int ret
Final status code.
Definition: gnunet-arm.c:89
#define GNUNET_memcpy(dst, src, n)
static char buf[2048]
static int result
Global testing status.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
VOID UnpackHostEnt(struct hostent *hostent)
Here is the call graph for this function:

Variable Documentation

◆ host

GUID host = { 0x0002a800, 0, 0, { 0xC0, 0, 0, 0, 0, 0, 0, 0x46 } }

◆ ip4

GUID ip4 = { 0x00090035, 0, 1, { 0xc0, 0, 0, 0, 0, 0, 0, 0x046 } }

Definition at line 40 of file w32nsp-resolve.c.

Referenced by ifc_proc(), process_helper_messages(), and request_done().

◆ ip6

GUID ip6 = { 0x00090035, 0, 0x001c, { 0xc0, 0, 0, 0, 0, 0, 0, 0x046 } }

Definition at line 41 of file w32nsp-resolve.c.

Referenced by ifc_proc(), process_helper_messages(), and request_done().