Blame


1 8f795179 2022-08-06 thomas
2 8f795179 2022-08-06 thomas #include <sys/socket.h>
3 8f795179 2022-08-06 thomas #include <netinet/in.h>
4 8f795179 2022-08-06 thomas
5 8f795179 2022-08-06 thomas #include <string.h>
6 8f795179 2022-08-06 thomas
7 8f795179 2022-08-06 thomas #include "got_sockaddr.h"
8 8f795179 2022-08-06 thomas
9 8f795179 2022-08-06 thomas /* These calls are found in lib/socketaddr.c, but are overriden here for
10 8f795179 2022-08-06 thomas * platform-specific reasons.
11 8f795179 2022-08-06 thomas */
12 8f795179 2022-08-06 thomas
13 8f795179 2022-08-06 thomas void
14 8f795179 2022-08-06 thomas got_sockaddr_inet_init(struct sockaddr_in *in, struct in_addr *ina)
15 8f795179 2022-08-06 thomas {
16 8f795179 2022-08-06 thomas in->sin_family = AF_INET;
17 8f795179 2022-08-06 thomas in->sin_addr.s_addr = ina->s_addr;
18 8f795179 2022-08-06 thomas }
19 8f795179 2022-08-06 thomas
20 8f795179 2022-08-06 thomas void
21 8f795179 2022-08-06 thomas got_sockaddr_inet6_init(struct sockaddr_in6 *in6, struct in6_addr *in6a,
22 8f795179 2022-08-06 thomas uint32_t sin6_scope_id)
23 8f795179 2022-08-06 thomas {
24 8f795179 2022-08-06 thomas in6->sin6_family = AF_INET6;
25 8f795179 2022-08-06 thomas memcpy(&in6->sin6_addr, in6a, sizeof(in6->sin6_addr));
26 8f795179 2022-08-06 thomas in6->sin6_scope_id = sin6_scope_id;
27 8f795179 2022-08-06 thomas }