clientinfo.c revision 1.1
1/*	$NetBSD: clientinfo.c,v 1.1 2024/02/18 20:57:30 christos Exp $	*/
2
3/*
4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5 *
6 * SPDX-License-Identifier: MPL-2.0
7 *
8 * This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11 *
12 * See the COPYRIGHT file distributed with this work for additional
13 * information regarding copyright ownership.
14 */
15
16/*! \file */
17
18#include <dns/clientinfo.h>
19#include <dns/ecs.h>
20
21void
22dns_clientinfomethods_init(dns_clientinfomethods_t *methods,
23			   dns_clientinfo_sourceip_t sourceip) {
24	methods->version = DNS_CLIENTINFOMETHODS_VERSION;
25	methods->age = DNS_CLIENTINFOMETHODS_AGE;
26	methods->sourceip = sourceip;
27}
28
29void
30dns_clientinfo_init(dns_clientinfo_t *ci, void *data, dns_ecs_t *ecs,
31		    void *versionp) {
32	ci->version = DNS_CLIENTINFO_VERSION;
33	ci->data = data;
34	ci->dbversion = versionp;
35	if (ecs != NULL) {
36		ci->ecs = *ecs;
37	} else {
38		dns_ecs_init(&ci->ecs);
39	}
40}
41