*/
ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize);
+/**
+ * Send an udp query and don't wait for an answer but return
+ * the socket
+ * \param[in] qbin the ldns_buffer to be send
+ * \param[in] to the ip addr to send to
+ * \param[in] tolen length of the ip addr
+ * \param[in] timeout the timeout value for the network
+ * \return the socket used
+ */
+
+int ldns_udp_sendbg(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
+
+/**
+ * Send an tcp query and don't wait for an answer but return
+ * the socket
+ * \param[in] qbin the ldns_buffer to be send
+ * \param[in] to the ip addr to send to
+ * \param[in] tolen length of the ip addr
+ * \param[in] timeout the timeout value for the network
+ * \return the socket used
+ */
+int ldns_tcp_sendbg(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
+
/**
* Sends a buffer to an ip using tcp and return the respons as a ldns_pkt
* \param[in] qbin the ldns_buffer to be send
return LDNS_STATUS_OK;
}
+int
+ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout)
+{
+ int sockfd;
+
+ sockfd = ldns_udp_connect(to, timeout);
+
+ if (sockfd == 0) {
+ return LDNS_STATUS_ERR;
+ }
+
+ if (ldns_udp_send_query(qbin, sockfd, to, tolen) == 0) {
+ return LDNS_STATUS_ERR;
+ }
+ return sockfd;
+}
+
/*
* ldns_tcp_server_connect
*
return LDNS_STATUS_OK;
}
+int
+ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout)
+{
+ int sockfd;
+
+ sockfd = ldns_tcp_connect(to, tolen, timeout);
+
+ if (sockfd == 0) {
+ return LDNS_STATUS_ERR;
+ }
+
+ if (ldns_tcp_send_query(qbin, sockfd, to, tolen) == 0) {
+ return LDNS_STATUS_ERR;
+ }
+
+ return sockfd;
+}
+
/* Move other function that use sockaddr to here, so that
* all networking code is contained in one file
*/