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

◆ main()

int main ( int  argc,
char **  argv 
)

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

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

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