1
0
mirror of https://passt.top/passt synced 2024-09-28 01:55:46 +00:00

treewide: Add include guards

...at the moment, just for consistency with packet.h, icmp.h,
tcp.h and udp.h.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-03-26 00:05:31 +01:00
parent bb70811183
commit 965f603238
15 changed files with 75 additions and 0 deletions

5
arch.h
View File

@ -3,4 +3,9 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef ARCH_H
#define ARCH_H
void arch_avx2_exec(char **argv);
#endif /* ARCH_H */

5
arp.h
View File

@ -3,6 +3,9 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef ARP_H
#define ARP_H
/**
* struct arpmsg - 802.2 ARP IPv4 payload
* @sha: Sender hardware address
@ -18,3 +21,5 @@ struct arpmsg {
} __attribute__((__packed__));
int arp(struct ctx *c, struct pool *p);
#endif /* ARP_H */

View File

@ -3,8 +3,13 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef CHECKSUM_H
#define CHECKSUM_H
uint32_t sum_16b(void *buf, size_t len);
uint16_t csum_fold(uint32_t sum);
uint16_t csum_unaligned(void *buf, size_t len, uint32_t init);
void csum_tcp4(struct iphdr *iph);
uint16_t csum(const void *buf, size_t len, uint32_t init);
#endif /* CHECKSUM_H */

5
conf.h
View File

@ -3,5 +3,10 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef CONF_H
#define CONF_H
void conf(struct ctx *c, int argc, char **argv);
void get_bound_ports(struct ctx *c, int ns, uint8_t proto);
#endif /* CONF_H */

5
dhcp.h
View File

@ -3,5 +3,10 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef DHCP_H
#define DHCP_H
int dhcp(struct ctx *c, struct pool *p);
void dhcp_init(void);
#endif /* DHCP_H */

View File

@ -3,6 +3,11 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef DHCPV6_H
#define DHCPV6_H
int dhcpv6(struct ctx *c, struct pool *p,
struct in6_addr *saddr, struct in6_addr *daddr);
void dhcpv6_init(struct ctx *c);
#endif /* DHCPV6_H */

5
ndp.h
View File

@ -3,5 +3,10 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef NDP_H
#define NDP_H
int ndp(struct ctx *c, struct icmp6hdr *ih, unsigned char *eh_source,
struct in6_addr *saddr);
#endif /* NDP_H */

View File

@ -3,9 +3,14 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef NETLINK_H
#define NETLINK_H
int nl_sock_init(struct ctx *c);
unsigned int nl_get_ext_if(int *v4, int *v6);
void nl_route(int ns, unsigned int ifi, sa_family_t af, void *gw);
void nl_addr(int ns, unsigned int ifi, sa_family_t af,
void *addr, int *prefix_len, void *addr_l);
void nl_link(int ns, unsigned int ifi, void *mac, int up, int mtu);
#endif /* NETLINK_H */

View File

@ -3,6 +3,9 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef PASST_H
#define PASST_H
#define UNIX_SOCK_MAX 100
#define UNIX_SOCK_PATH "/tmp/passt_%i.socket"
@ -232,3 +235,5 @@ struct ctx {
void proto_update_l2_buf(unsigned char *eth_d, unsigned char *eth_s,
uint32_t *ip_da);
#endif /* PASST_H */

View File

@ -3,8 +3,13 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef PASTA_H
#define PASTA_H
void pasta_start_ns(struct ctx *c);
void pasta_ns_conf(struct ctx *c);
void pasta_child_handler(int signal);
int pasta_netns_quit_init(struct ctx *c);
void pasta_netns_quit_handler(struct ctx *c, int inotify_fd);
#endif /* PASTA_H */

5
pcap.h
View File

@ -3,7 +3,12 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef PCAP_H
#define PCAP_H
void pcap(char *pkt, size_t len);
void pcapm(struct msghdr *mh);
void pcapmm(struct mmsghdr *mmh, unsigned int vlen);
void pcap_init(struct ctx *c);
#endif /* PCAP_H */

View File

@ -3,8 +3,13 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef SIPHASH_H
#define SIPHASH_H
uint64_t siphash_8b(const uint8_t *in, const uint64_t *k);
uint32_t siphash_12b(const uint8_t *in, const uint64_t *k);
uint64_t siphash_20b(const uint8_t *in, const uint64_t *k);
uint32_t siphash_32b(const uint8_t *in, const uint64_t *k);
uint32_t siphash_36b(const uint8_t *in, const uint64_t *k);
#endif /* SIPHASH_H */

5
tap.h
View File

@ -3,8 +3,13 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef TAP_H
#define TAP_H
void tap_ip_send(struct ctx *c, struct in6_addr *src, uint8_t proto,
char *in, size_t len, uint32_t flow);
int tap_send(struct ctx *c, void *data, size_t len, int vnet_pre);
void tap_handler(struct ctx *c, int fd, uint32_t events, struct timespec *now);
void tap_sock_init(struct ctx *c);
#endif /* TAP_H */

View File

@ -3,6 +3,9 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef TCP_SPLICE_H
#define TCP_SPLICE_H
#define TCP_SPLICE_MAX_CONNS (128 * 1024)
struct tcp_splice_conn;
@ -13,3 +16,5 @@ void tcp_splice_destroy(struct ctx *c, struct tcp_splice_conn *conn);
void tcp_splice_init(struct ctx *c);
void tcp_splice_timer(struct ctx *c);
void tcp_splice_defer_handler(struct ctx *c);
#endif /* TCP_SPLICE_H */

5
util.h
View File

@ -3,6 +3,9 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef UTIL_H
#define UTIL_H
void err(const char *format, ...);
void warn(const char *format, ...);
void info(const char *format, ...);
@ -213,3 +216,5 @@ int ns_enter(struct ctx *c);
void write_pidfile(int fd, pid_t pid);
int __daemon(int pidfile_fd, int devnull_fd);
int fls(unsigned long x);
#endif /* UTIL_H */