It has been pointed out that the wording of the license of this library is not entirely clear. The term "dual licensing" usually refers to a licence choice of two licenses "LICENSE1 _or_ LICENSE2. Instead the license of this library claimed "LICENSE1 _and_ LICENSE2". After an internal discussion with @metajack and @pasis it was made clear that the initial idea was to dual license the library in the usual way. This was also made clear by jack on the ML in the past [0]. As of jack, these licensing terms originated from jquery, which also used the 'and' version in the past and has since been corrected [1]. This patch changes the license terms to 'MIT or GPLv3' and also adds SPDX headers [2]. [0] https://groups.google.com/g/libstrophe/c/JkFgr601JQc [1] https://stackoverflow.com/q/2758409 [2] https://spdx.org Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
85 lines
2.5 KiB
C
85 lines
2.5 KiB
C
/* SPDX-License-Identifier: MIT OR GPL-3.0-only */
|
|
/* resolver.h
|
|
* strophe XMPP client library -- DNS resolver
|
|
*
|
|
* Copyright (C) 2015 Dmitry Podgorny <pasis.ua@gmail.com>
|
|
*
|
|
* This software is provided AS-IS with no warranty, either express
|
|
* or implied.
|
|
*
|
|
* This program is dual licensed under the MIT or GPLv3 licenses.
|
|
*/
|
|
|
|
/** @file
|
|
* DNS resolver.
|
|
*/
|
|
|
|
#ifndef __LIBSTROPHE_RESOLVER_H__
|
|
#define __LIBSTROPHE_RESOLVER_H__
|
|
|
|
#include "ostypes.h"
|
|
#include "common.h"
|
|
|
|
typedef enum {
|
|
XMPP_DOMAIN_NOT_FOUND,
|
|
XMPP_DOMAIN_FOUND,
|
|
XMPP_DOMAIN_ALTDOMAIN
|
|
} xmpp_domain_state_t;
|
|
|
|
typedef struct resolver_srv_rr_struc {
|
|
uint16_t priority;
|
|
uint16_t weight;
|
|
uint16_t port;
|
|
char target[MAX_DOMAIN_LEN];
|
|
struct resolver_srv_rr_struc *next;
|
|
} resolver_srv_rr_t;
|
|
|
|
void resolver_initialize(void);
|
|
void resolver_shutdown(void);
|
|
|
|
resolver_srv_rr_t *resolver_srv_rr_new(xmpp_ctx_t *ctx,
|
|
const char *host,
|
|
unsigned short port,
|
|
unsigned short prio,
|
|
unsigned short weight);
|
|
|
|
/** Perform lookup for RFC1035 message format.
|
|
* This function allocates all elements.
|
|
*
|
|
* @param ctx a Strophe context object
|
|
* @param buf message in RFC1035 format
|
|
* @param len length of the message
|
|
* @param srv_rr_list is the result
|
|
*
|
|
* @return XMPP_DOMAIN_FOUND on success or XMPP_DOMAIN_NOT_FOUND on fail
|
|
*/
|
|
int resolver_srv_lookup_buf(xmpp_ctx_t *ctx,
|
|
const unsigned char *buf,
|
|
size_t len,
|
|
resolver_srv_rr_t **srv_rr_list);
|
|
/** Resolve SRV record.
|
|
*
|
|
* @param ctx a Strophe context object
|
|
* @param service service of the SRV record
|
|
* @param proto protocol of the SRV record
|
|
* @param domain resolving domain
|
|
* @param srv_rr_list is the result
|
|
*
|
|
* @return XMPP_DOMAIN_FOUND on success or XMPP_DOMAIN_NOT_FOUND on fail
|
|
*/
|
|
int resolver_srv_lookup(xmpp_ctx_t *ctx,
|
|
const char *service,
|
|
const char *proto,
|
|
const char *domain,
|
|
resolver_srv_rr_t **srv_rr_list);
|
|
|
|
/** Release a list returned by resolver_srv_lookup() or
|
|
* resolver_srv_lookup_buf().
|
|
*
|
|
* @param ctx a Strophe context object
|
|
* @param srv_rr_list a list allocated by lookup functions
|
|
*/
|
|
void resolver_srv_free(xmpp_ctx_t *ctx, resolver_srv_rr_t *srv_rr_list);
|
|
|
|
#endif /* __LIBSTROPHE_RESOLVER_H__ */
|