Hello,

Here is the patch I wrote to query the register for name servers. It is a
diff against sresolv.c in the cvs. It changes sres_parse_resolv_conf
function. I am not sure if the same function should query the register under
windows and parse resolv.conf on *nix systems. If so, maybe it should have
it's name changed, or alternatively its functionality be split in two
functions. Windows can have different name servers for each interface , I
find that very odd, since name resolution is interface independent. Since
the resolver doesn't know ( and doesn't need to know ) wich interface will
be used , this patch reads all namesevers from all interfaces and adds them
to the dns_list . To simplify the patch , we only read the first 64 bytes of
the nameserver list on each interface , that’s about 4 name servers per
interface. I don't think we need to handle more than that ( windows defaults
to two name servers per interface , but you can add more through an
"advanced" configuration button). To handle more nameservers per interface,
just increase name_server_length ( two assignments ) and the size of char
name_server[].  One last note, this code works for me, and as far as I know
is the standard way to ger nameservers under windows. Let me know if this is
usefull or if there are any problems with the patch. There is also a need to
link with advapi32.lib on windows.

Regards,

Dimitri





> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: sexta-feira, 21 de abril de 2006 03:59
> To: [EMAIL PROTECTED]
> Cc: [email protected]
> Subject: RE: [Sofia-sip-devel] resolver under windows
> 
> Hey,
> 
> Great that you wrote the patch! Please send it to me or to the list as an
> attachment and I could start merging the code.
> 
> Regards,
> 
> Martti
> 
> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED] On Behalf
> >Of ext Dimitri E. Prado
> >Sent: 20. huhtikuuta 2006 23:13
> >To: [email protected]
> >Subject: RE: [Sofia-sip-devel] resolver under windows
> >
> >I wrote a quick patch that queries the windos registry for the
> >dns servers.
> >If you want to take a look at it, let me know.
> >
> >Regards
> >
> >Dimitri
> >
> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED] On Behalf
> >Of Dimitri E.
> >Prado
> >Sent: quarta-feira, 19 de abril de 2006 14:10
> >To: [email protected]
> >Subject: Re: [Sofia-sip-devel] resolver under windows
> >
> >>> I just started using Sofia and I can't get dns resolutiomn
> >to work under
> >>> windows. Turning debug on I see that sresolv keeps trying to query
> >>> my localhost
> >>> for dns answers. A quick glance at the code , shows a
> >possible culprit,
> >as
> >>
> >> Yeps, this is a known issue:
> >>
> >>
> >http://sourceforge.net/tracker/index.php?func=detail&aid=144556
> >0&group_id=14
> >3636&atid=756076
> >
> >sorry for reporting, I should have looked the bug tracker first.
> >>
> >> Shortly put, Sofia uses its own async DNS resolver instead the system
> >> resolver, and we need to find out the system DNS server addresses on
> >> startup. On UNIX systems, this information can be read from
> >> /etc/resolv.conf, but and now we need something similar for win32.
> >>
> >> I guess the options are:
> >>
> >> 1) have users create a resolv.conf file for win32 --> define a good
> >>    default location instead of /etc/resolv.conf to use on win32
> >personally I don´t like this approach since you´d have to keep track of
> >changes and keeping this /etc/hosts in sync with the interfaces dns
> >servers.  I have experienced to much trouble under unix with forgotten
> >entries on the
> >/etc/hosts file that superseed dns resolving.
> >> 2) use some win32 API functions (windns.h:DnsQueryConfig() maybe?) to
> >>    query the server addresses on startup
> >unfortunately DnsQueryconfig is only available on XP and windows 2000
> >Professional and up.
> >> 3) fetch the information from win32 registry
> >sounds like the best approach so far. Aparently
> >
> >HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfa
> >ces\<guid
> >for specific interface>\NameServer
> >
> >holds this info. I have to find out if this is valid for all windows
> >versions.
> >
> >One could open
> >HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces and
> >for each
> >interface listed lookup IPAddress and see if it matches the
> >bound interface
> >address , if so, use the NameServer value.
> >
> >
> >Dimitri
> >
> >
> >
> >-------------------------------------------------------
> >Using Tomcat but need to do more? Need to support web
> >services, security?
> >Get stuff done quickly with pre-integrated technology to make your job
> >easier
> >Download IBM WebSphere Application Server v.1.0.1 based on
> >Apache Geronimo
> >http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642
> >_______________________________________________
> >Sofia-sip-devel mailing list
> >[email protected]
> >https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
> >
> >
> >
> >-------------------------------------------------------
> >Using Tomcat but need to do more? Need to support web
> >services, security?
> >Get stuff done quickly with pre-integrated technology to make
> >your job easier
> >Download IBM WebSphere Application Server v.1.0.1 based on
> >Apache Geronimo
> >http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642
> >_______________________________________________
> >Sofia-sip-devel mailing list
> >[email protected]
> >https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
> >

Attachment: sresolv.c.diff
Description: Binary data

Reply via email to