<commit_before>/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2006 Nokia Corporation.
 *
 * Contact: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

/**
 * @file stun_dns.c 
 * @brief Functins to discover STUN server address using DNS-SRV.
 *
 * Refs: 
 *   - RFC3489/3489bis
 *   - RFC2782
 * 
 * @author <NAME> <<EMAIL>>
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define STUN_SRV_SERVICE_TCP "_stun._tcp"
#define STUN_SRV_SERVICE_UDP "_stun._udp"

#include <sofia-sip/stun.h>
#include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_wait.h>
#define HAVE_SU_WAIT_H 1 /* workaround for bug in sresolv.h */
#define SRES_CONTEXT_T stun_dns_lookup_t
#include <sofia-sip/sresolv.h>

#include "stun_internal.h"

struct stun_dns_lookup_s {
  su_home_t          stun_home[1];
  su_root_t         *stun_root;
  stun_magic_t      *stun_magic;
  sres_resolver_t   *stun_sres;
  int                stun_socket;
  stun_dns_lookup_f  stun_cb;
  char              *stun_tcp_target;
  char              *stun_udp_target;
  uint16_t           stun_tcp_port;
  uint16_t           stun_udp_port;
  unsigned           stun_state:2;       /**< bit0:udp, bit1:tcp */
};
<commit_msg>No need to define HAVE_SU_WAIT_H.<commit_after>/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2006 Nokia Corporation.
 *
 * Contact: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

/**
 * @file stun_dns.c 
 * @brief Functins to discover STUN server address using DNS-SRV.
 *
 * Refs: 
 *   - RFC3489/3489bis
 *   - RFC2782
 * 
 * @author <NAME> <<EMAIL>>
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define STUN_SRV_SERVICE_TCP "_stun._tcp"
#define STUN_SRV_SERVICE_UDP "_stun._udp"

#include <sofia-sip/stun.h>
#include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_wait.h>
#define SRES_CONTEXT_T stun_dns_lookup_t
#include <sofia-sip/sresolv.h>

#include "stun_internal.h"

struct stun_dns_lookup_s {
  su_home_t          stun_home[1];
  su_root_t         *stun_root;
  stun_magic_t      *stun_magic;
  sres_resolver_t   *stun_sres;
  int                stun_socket;
  stun_dns_lookup_f  stun_cb;
  char              *stun_tcp_target;
  char              *stun_udp_target;
  uint16_t           stun_tcp_port;
  uint16_t           stun_udp_port;
  unsigned           stun_state:2;       /**< bit0:udp, bit1:tcp */
};

{'fraction_non_alphanumeric': 0.0901018542700444, 'fraction_numerical': 0.019587359623922697, 'mean_word_length': 3.185792349726776, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4489061', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1337, 'n_words': 416}