pub fn search(&mut self,
                  name: &[u8],
                  class: Class,
                  typ: RecordType)
                  -> Result<Response, Error>
    {
        let name = match CString::new(name) {
            Ok(c) => c,
            Err(n) => return Err(Error::CString(n)),
        };
        let buflen: usize = libresolv_sys::NS_PACKETSZ as usize;
        let mut buffer: Box<Vec<u8>> = Box::new(Vec::with_capacity(buflen));

        let rlen: i32 = unsafe {
            libresolv_sys::__res_nsearch(
                &mut self.context,
                name.as_ptr(),
                class as i32,
                typ as i32,
                buffer.deref_mut().as_mut_ptr(),
                buflen as i32)
        };
        if rlen==-1 {
            return Err(From::from(self.get_error()));
        }

        let mut msg: libresolv_sys::__ns_msg = libresolv_sys::__ns_msg::default();
        unsafe {
            if libresolv_sys::ns_initparse(buffer.deref().as_ptr(), rlen, &mut msg) < 0 {
                return Err(Error::ParseError);
            }
        }

        Ok(Response::new(msg, buffer))
    }
/// Lookup the record.  Applies the search algorithm to the domain name given
/// (if not fully qualified, it completes it using rules specified in `resolv.conf`
/// search entries).  In addition, this also searches your hosts file.  Applies
/// recursion if available and not turned off (it is on by default).
///
/// This is the highest level resolver routine, and is the one called by
/// gethostbyname.
Lookup the record.  Applies the search algorithm to the domain name given
(if not fully qualified, it completes it using rules specified in `resolv.conf`
search entries).  In addition, this also searches your hosts file.  Applies
recursion if available and not turned off (it is on by default).

This is the highest level resolver routine, and is the one called by
gethostbyname.
Lookup the record . Applies the search algorithm to the domain name given ( if not fully qualified it completes it using rules specified in ` resolv . conf ` search entries ) . In addition this also searches your hosts file . Applies recursion if available and not turned off ( it is on by default ) . This is the highest level resolver routine and is the one called by gethostbyname .
pub fn search(&mut self,
                  name: &[u8],
                  class: Class,
                  typ: RecordType)
                  -> Result<Response, Error>
    {
        let name = match CString::new(name) {
            Ok(c) => c,
            Err(n) => return Err(Error::CString(n)),
        };
        let buflen: usize = libresolv_sys::NS_PACKETSZ as usize;
        let mut buffer: Box<Vec<u8>> = Box::new(Vec::with_capacity(buflen));
        let rlen: i32 = unsafe {
            libresolv_sys::__res_nsearch(
                &mut self.context,
                name.as_ptr(),
                class as i32,
                typ as i32,
                buffer.deref_mut().as_mut_ptr(),
                buflen as i32)
        };
        if rlen==-1 {
            return Err(From::from(self.get_error()));
        }
        let mut msg: libresolv_sys::__ns_msg = libresolv_sys::__ns_msg::default();
        unsafe {
            if libresolv_sys::ns_initparse(buffer.deref().as_ptr(), rlen, &mut msg) < 0 {
                return Err(Error::ParseError);
            }
        }
        Ok(Response::new(msg, buffer))
    }
pub fn search ( & mut self , name : & [ u8 ] , class : Class , typ : RecordType ) -> Result < Response , Error > { let name = match CString :: new ( name ) { Ok ( c ) => c , Err ( n ) => return Err ( Error :: CString ( n ) ) , } ; let buflen : usize = libresolv_sys :: NS_PACKETSZ as usize ; let mut buffer : Box < Vec < u8 > > = Box :: new ( Vec :: with_capacity ( buflen ) ) ; let rlen : i32 = unsafe { libresolv_sys :: __res_nsearch ( & mut self . context , name . as_ptr ( ) , class as i32 , typ as i32 , buffer . deref_mut ( ) . as_mut_ptr ( ) , buflen as i32 ) } ; if rlen == - 1 { return Err ( From :: from ( self . get_error ( ) ) ) ; } let mut msg : libresolv_sys :: __ns_msg = libresolv_sys :: __ns_msg :: default ( ) ; unsafe { if libresolv_sys :: ns_initparse ( buffer . deref ( ) . as_ptr ( ) , rlen , & mut msg ) < 0 { return Err ( Error :: ParseError ) ; } } Ok ( Response :: new ( msg , buffer ) ) }
Lookup the record.
Lookup the record .
&mut self
name
&[u8]
class
Class
typ
RecordType
&mut self
name
&[u8]
class
Class
typ
RecordType