Networking Forums

Networking Forums > Computer Networking > Linux Networking > DNS NAMESERVER FUNCTIONS - USER DEFINED / BUILT-IN? URGENT!

Reply
Thread Tools Display Modes

DNS NAMESERVER FUNCTIONS - USER DEFINED / BUILT-IN? URGENT!

 
 
zoltan
Guest
Posts: n/a

 
      02-13-2006, 04:27 AM
hi folks,
This is a more detailed update to the previous post.

Problem : to determine whether the DNS Nameserver functions (
prototypes in <arpa/nameser.h> ) are user-defined or built in in the
libresolv library!!!!

Source file : myDns.c which uses 'ns_name_uncompress' and 'ns_parserr'
functions which are declared in the mentioned header file. But while
ns_parserr(...) works without any user-defined body, the
ns_name_uncompress(...) function gives linker error without a
user-defined body. Why the disparity? Can anyone please enlighten me?



Here's a part of the process :


[timmyj@ibis:/users/in1478c/GUIDEPROGS~]gcc -Wall -g myDns.c -lsocket
-lnsl -lresolv
myDns.c: In function `send_ptr_query':
myDns.c:108: warning: initialization from incompatible pointer type
myDns.c:108: warning: initialization from incompatible pointer type
Undefined first referenced
symbol in file
__ns_name_uncompress /var/tmp//ccGTqvma.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
[timmyj@ibis:/users/in1478c/GUIDEPROGS~]


The function ns_name_uncompress is geiven as a prototype in
<arpa/nameser.h>
but the file 'myDns.c' does not contain the definition. ( It is present

in another source file called 'rr_name.c'...) But some other functions
such as 'ns_parserr' whose prototypes are present in the same header
file and whose bodies are not defined in the 'myDns.c' source file do
not generate any error!!!


The calling function is :


if (ns_name_uncompress(
ns_msg_base(handle),/* Start of the
packet */
ns_msg_end(handle), /* End of the
packet */
ns_rr_rdata(rr), /* Position in the

packet*/
hostname, /*Result*/
255) /* Size of server
name buffer */
< 0)
{ /* Negative: error */
printf(", ns_name_uncompress failed on %dth
record\n",rrnum);
continue;
}
printf(", Server name : %s\n", hostname);


The types are as follows :


// The code from the header file arpa/nameser.h
typedef struct __ns_msg {
const uchar_t *_msg, *_eom;
uint16_t _id, _flags, _counts[ns_s_max];
const uchar_t *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
const uchar_t *_ptr;


} ns_msg;


/* Private data structure - do not use from outside library. */
struct _ns_flagdata { int mask, shift; };
extern struct _ns_flagdata _ns_flagdata[];


/* Accessor macros - this is part of the public interface. */
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)


The prototype of the ns_name_uncompress function given in the
<arpa/nameser.h> header file is :


int ns_name_uncompress(const uchar_t *, const uchar_t *,
const uchar_t *, char *, size_t);


As you can see, the types in the prototype and the invocation are the
same!!!!
Any ideas, please?!


Regards,


Timmy Jose.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do all DNS Nameserver functions have to be user-defined? Urgent... zoltan Linux Networking 0 02-10-2006 05:14 AM
TFTP server not receiving a file which sent on user defined port from windows client GS Linux Networking 1 07-13-2005 05:13 PM
In need of URGENT help with user profiles Eric Graham Windows Networking 1 06-14-2004 02:21 PM
Cannot access SBS clients from server, Please Help! Urgent! Urgent! Urgent! novice Windows Networking 1 04-06-2004 12:46 PM
iptables: DNAT + user defined chains Jan Kanty Palus Linux Networking 2 03-06-2004 08:24 AM



1 2 3 4 5 6 7 8 9 10 11