]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_int.c
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / pimd / pim_int.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * PIM for Quagga
4 * Copyright (C) 2008 Everton da Silva Marques
5 */
6
7 #include <zebra.h>
8
9 #include <string.h>
10 #include <netinet/in.h>
11 #include <arpa/inet.h>
12
13 #include "pim_int.h"
14
15 uint32_t pim_read_uint32_host(const uint8_t *buf)
16 {
17 uint32_t val;
18 memcpy(&val, buf, sizeof(val));
19 /* val is in netorder */
20 val = ntohl(val);
21 /* val is in hostorder */
22 return val;
23 }
24
25 void pim_write_uint32(uint8_t *buf, uint32_t val_host)
26 {
27 /* val_host is in host order */
28 val_host = htonl(val_host);
29 /* val_host is in netorder */
30 memcpy(buf, &val_host, sizeof(val_host));
31 }