fail_over_srv.c revision a3c8390d19593b1e5277d95bfb4ab206d4785150
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2013 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <strings.h>
#include <talloc.h>
#include <tevent.h>
#include "resolv/async_resolv.h"
#include "providers/fail_over_srv.h"
struct fo_discover_srv_state {
char *dns_domain;
struct fo_server_info *servers;
};
struct tevent_context *ev,
struct resolv_ctx *resolv_ctx,
const char *service,
const char *protocol,
const char **discovery_domains)
{
return NULL;
}
goto immediately;
}
return req;
return req;
}
{
int i;
goto done;
goto done;
goto done;
}
/* sort and store the answer */
goto done;
}
state->num_servers = 0;
state->num_servers++;
}
state->num_servers);
goto done;
}
for (record = reply_list, i = 0;
}
done:
return;
}
}
struct tevent_req *req,
char **_dns_domain,
struct fo_server_info **_servers,
{
if (_dns_domain != NULL) {
}
}
if (_num_servers != NULL) {
}
return EOK;
}
struct fo_discover_servers_state {
struct tevent_context *ev;
struct resolv_ctx *resolv_ctx;
const char *service;
const char *protocol;
const char *primary_domain;
const char *backup_domain;
char *dns_domain;
struct fo_server_info *primary_servers;
struct fo_server_info *backup_servers;
};
struct tevent_context *ev,
struct resolv_ctx *resolv_ctx,
const char *service,
const char *protocol,
const char *primary_domain,
const char *backup_domain)
{
struct fo_discover_servers_state);
return NULL;
}
if (primary_domain == NULL) {
if (backup_domain == NULL) {
state->num_primary_servers = 0;
state->num_backup_servers = 0;
goto immediately;
} else {
}
}
goto immediately;
}
goto immediately;
}
goto immediately;
}
goto immediately;
}
goto immediately;
}
goto immediately;
}
return req;
return req;
}
{
&state->dns_domain,
/* abort on system error */
goto done;
}
}
/* if there is no backup domain, we are done */
goto done;
}
/* If there was no error and dns_domain is the same as backup domain,
* it means that we were unable to resolve SRV in primary domain, but
* SRV from backup domain was resolved and those servers are considered
* to be primary. We are done. */
state->num_backup_servers = 0;
goto done;
}
goto done;
}
goto done;
}
done:
}
return;
}
{
/* we have successfully fetched primary servers, so we will
* finish the request normally on non system error */
}
}
return;
}
}
struct tevent_req *req,
char **_dns_domain,
struct fo_server_info **_primary_servers,
struct fo_server_info **_backup_servers,
{
if (_primary_servers) {
}
if (_num_primary_servers) {
}
if (_backup_servers) {
}
if (_num_backup_servers) {
}
if (_dns_domain) {
}
return EOK;
}
struct fo_resolve_srv_dns_ctx {
struct resolv_ctx *resolv_ctx;
enum restrict_family family_order;
enum host_database *host_dbs;
char *hostname;
char *sssd_domain;
char *detected_domain;
};
struct fo_resolve_srv_dns_state {
struct tevent_context *ev;
struct fo_resolve_srv_dns_ctx *ctx;
const char *service;
const char *protocol;
const char *discovery_domain;
char *dns_domain;
struct fo_server_info *servers;
};
struct fo_resolve_srv_dns_ctx *
struct resolv_ctx *resolv_ctx,
enum restrict_family family_order,
enum host_database *host_dbs,
const char *hostname,
const char *sssd_domain)
{
return NULL;
}
goto fail;
}
goto fail;
}
return ctx;
fail:
return NULL;
}
struct tevent_context *ev,
const char *service,
const char *protocol,
const char *discovery_domain,
void *pvt)
{
return NULL;
}
goto immediately;
}
if (discovery_domain == NULL) {
} else {
}
/* we will try to detect proper discovery domain */
ctx->family_order);
goto immediately;
}
} else {
/* we will use either provided or previously detected
* discovery domain */
goto immediately;
}
}
return req;
} else {
}
return req;
}
{
goto done;
}
done:
}
return;
}
{
goto done;
}
/* we will use detected domain with SSSD domain as fallback */
goto done;
}
goto done;
}
}
} else {
/* We will use only discovery domain that was provided via plugin
* interface. We don't have to dup here because it is already on
* state. */
}
goto done;
}
done:
}
return ret;
}
{
goto done;
}
done:
return;
}
}
struct tevent_req *req,
char **_dns_domain,
struct fo_server_info **_primary_servers,
struct fo_server_info **_backup_servers,
{
if (_primary_servers) {
}
if (_num_primary_servers) {
}
/* backup servers are not supported by simple srv lookup */
if (_backup_servers) {
*_backup_servers = NULL;
}
if (_num_backup_servers) {
*_num_backup_servers = 0;
}
if (_dns_domain) {
}
return EOK;
}