Source file src/net/cgo_unix_cgo_resn.go

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // res_nsearch, for cgo systems where that's available.
     6  
     7  //go:build cgo && !netgo && unix && !(darwin || linux || openbsd)
     8  
     9  package net
    10  
    11  /*
    12  #include <sys/types.h>
    13  #include <sys/socket.h>
    14  #include <netinet/in.h>
    15  #include <netdb.h>
    16  #include <unistd.h>
    17  #include <string.h>
    18  #include <arpa/nameser.h>
    19  #include <resolv.h>
    20  
    21  #cgo !aix,!dragonfly,!freebsd LDFLAGS: -lresolv
    22  */
    23  import "C"
    24  
    25  type _C_struct___res_state = C.struct___res_state
    26  
    27  func _C_res_ninit(state *_C_struct___res_state) error {
    28  	_, err := C.res_ninit(state)
    29  	return err
    30  }
    31  
    32  func _C_res_nclose(state *_C_struct___res_state) {
    33  	C.res_nclose(state)
    34  }
    35  
    36  func _C_res_nsearch(state *_C_struct___res_state, dname *_C_char, class, typ int, ans *_C_uchar, anslen int) int {
    37  	x := C.res_nsearch(state, dname, C.int(class), C.int(typ), ans, C.int(anslen))
    38  	return int(x)
    39  }
    40  

View as plain text