Lines Matching refs:fd
151 int fd = *(int *)dtls_get_app_data(ctx); in send_to_peer() local
152 return sendto(fd, data, len, MSG_DONTWAIT, in send_to_peer()
158 int *fd; in dtls_handle_read() local
163 fd = dtls_get_app_data(ctx); in dtls_handle_read()
165 assert(fd); in dtls_handle_read()
169 len = recvfrom(*fd, buf, sizeof(buf), MSG_TRUNC, in dtls_handle_read()
279 int fd, opt, result; local
317 fd = socket(listen_addr.sin6_family, SOCK_DGRAM, 0);
319 if (fd < 0) {
324 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on) ) < 0) {
328 flags = fcntl(fd, F_GETFL, 0);
329 if (flags < 0 || fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
336 if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on) ) < 0) {
338 if (setsockopt(fd, IPPROTO_IPV6, IPV6_PKTINFO, &on, sizeof(on) ) < 0) {
343 if (bind(fd, (struct sockaddr *)&listen_addr, sizeof(listen_addr)) < 0) {
350 the_context = dtls_new_context(&fd);
358 FD_SET(fd, &rfds);
364 result = select( fd+1, &rfds, &wfds, 0, &timeout);
371 if (FD_ISSET(fd, &wfds))
373 else if (FD_ISSET(fd, &rfds)) {