I have a windows C++ application (mingw, but I guess it doesn't matter). I need to do very occasional obscure types of DNS lookups, such as TXT and AXFR.
The best I can do at the moment is using gethostbyname in winsock, but that doesn't support the above types :(. Does anyone know of a nice library that runs on win32 for DNS lookups?
thanks
thn
I recommend using libunbound which is included in the source distribution of the Unbound recursive DNS server.
It's a full-feature recursive resolver bundled in a library. Alternatively the same group has a generic DNS library with a stub resolver called ldns.
p.s. are you sure mingw doesn't support the UNIX standard libresolv? Check for a function called res_query.
Related
I would like to ask if there is a way to read DHCP option in Qt or c++ (Qt would be better) on linux. I have my own cups backend and would like to read option 9 - LPR Servers (all of the listed IP addresses) and use it as device uri.
So I want to know how to get specific (or all) option(s) informations from the DHCP lease.
I've looked to Qt's documentation but wasn't able to find anything useful and couldn't find any c++ libraries for linux.
I had exactly the same problem. I have found a library called Libcrafter which has a lot of features including DHCP support. There is a good example of DHCP usage in their examples. It is example #8.
This requirement is quite specific. I don't know there's such individual library for mere DHCP options.
So my suggestion is that, down one DHCP implementation(http://en.wikipedia.org/wiki/Comparison_of_DHCP_server_software), study how it handles the options.
Take dnsmasq_2.72 as an example, in file src/dhcp-common.c, there's function lookup_dhcp_opt().
Powerbuilder does not seem to have a SFTP functionality built in (Please correct me if I'm wrong, but I couldn't find it anywhere in the documentation).
I'm assuming I have to import C/C++ DLL of SFTP to handle this problem, but I'd like to know if there's any better alternatives.
Also, are there any examples I can look at for how SFTP is done in powerbuilder?
I'm using Powerbuilder 10.2.1
You might look at this sample:
http://www.topwizprogramming.com/freecode_ftpclient.html
When you do the HttpOpenRequest one of the flags that is passed will indicate whether it should be a secure connection (INTERNET_FLAG_SECURE).
There are also third party controls that would make it easier. For example
Dart: http://www.dart.com/samp_powerbuilder.aspx
WeOnlyDo software: http://nathanepralle.ulitzer.com/node/220784/mobile
The Topwiz FTPClient example does not do SFTP, just regular FTP. It is just a really fancy shell over WinInet.dll (part of Internet Explorer). WinInet.dll does not support SFTP. I would recommend using a 3rd party ActiveX control.
I have used this one from Classic ASP with good results:
http://www.activexperts.com/network-component/
You can create a .NET dll and use it from PB as COM component using Tamir SharpSSH library, an open source SSH library for .NET.
I have 2 questions:
Q1 : Does anyone know a good C++ library to perform requests towards a HTTPS server?
Note that the SSL certificate on the server will be provided by a certificate autority like VeriSign.
Q2 : So, could I embedded the root certificate of the CA in my C++ application so that it will be automatically used by the library? I don't want the user to add it manually in its operating system.
Thanks for your advices.
libcurl (C++ library here: http://code.google.com/p/curlpp/)
PoCo Networking PDF, pg. 36+
would both be able to use openssl. You can make it use CA certs provided by your application. I don't think it is easy to use embedded resources
I guess libcurl is one of the better known networking libraries out there. In my experience being written in C (with all the wheel reinventing that that brings) it has proven to be crash-prone at times and doesn't have the nicest of APIs. That said though, it's used in a ton of places, is relatively easy to get to grips with, and supports just about everything you could ever need.
ON WIndows,There is a small library, or rather just a small set of c++ headrs:http://www.codeproject.com/Articles/66625/A-Fully-Featured-Windows-HTTP-Wrapper-in-C
I know DNS is typically handled by the operating system, but I'm working under the assumption that DNS has been broken on the target system (this is a tool to diagnose DNS misconfiguration). I therefore need to implement DNS myself, to check the results I get back from the system against a known good DNS server.
You can do this with the NSLookup or Dig tools, specifying a DNS server address manually, but it appears the Windows API calls for doing this (e.g. GetAddressByName) don't allow me to specify a server to query, and use the system's configured target instead.
I tried to look for the RFCs on DNS, but unfortunately they are clear as mud to me -- they make the HTTP spec look like the clearest and most well written spec ever produced.
I also don't want to reinvent something that someone else has already done several times before.
You might try: http://25thandclement.com/~william/projects/dns.c.html . Also, see Need To Build Simple DNS Resolver in C
Actually, a Google search of "DNS resolver C" reveals several possibilities.
Try the c-ares library, which as I understand it does implement its own DNS stack. I've used it successfully on linux, and they say that it supports Windows, though I haven't tried it myself. It isn't C++, just plain C, but you can easily enough write a C++ wrapper for it.
It gets bonus points for being asynchronous, and providing hooks by which you can integrate it with an existing event loop.
I know that the question is old, but I haven't found good answer for me here.
I have found poslib as the best dns library with very easy interface.
http://www.vantage-points.org/libvdns.html
http://directory.fsf.org/project/FireDNS/
Did never use this, but maybe that helps you?
I'd suggest libunbound which (together with ldns) is a standalone library included with the Unbound recursive resolver.
It has DNSSEC validation support too, which will become useful as DNSSEC continues to get deployed.
See http://unbound.net/
djbdns contains a DNS client library which you could use:
http://cr.yp.to/djbdns/dns.html
This is independent of the system DNS resolver libraries and will generate the right UDP packets. If you really wanted to get clever, you could combine it with dnscache, or look at the dnstrace utility to resolve names from root servers and see what is really going on.
You'd need to make it work on Windows, of course. Shouldn't be that hard.
I need to download files/read strings from a specified url in C++. I've done some research with this, cURL seems to be the most popular method. Also, I've used it before in PHP. The problem with cURL is that the lib is huge, and my file has to be small. I think you can do it with winsock, but I can't find any simple examples. If you have a simple winsock example, a light cURL/Something else, or anything that could get the job done. I would greatly appreciated. Also, I need this to work with native C++.
I can repeat me answer Is it possible to handle proxies at socket level? (see also comments) about two important interfaces Windows Internet (WinINet) API and Windows HTTP Services (WinHTTP). An important restriction of WinINet is that WinINet should be not used in a service (only in GUI app.) because of possible dialogs.
you should try WinInet: this library is part of Windows operating system, and allows to download a resource identified by an URL, using either HTTP or FTP.
if you are using HTTP, you might find the InternetOpenUrl() function useful.