📄 util.h
字号:
/* $Id: util.h,v 1.24 2001/09/08 14:28:27 jm Exp $ * Help routines for the agents * * Dynamic hierarchial IP tunnel * Copyright (C) 1998-2001, Dynamics group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See README and COPYING for * more details. */#ifndef UTIL_H#define UTIL_H#include <sys/time.h>#include "message.h"#define MOVE_UNALIGNED(a,b,n) do { int _i; \ char *_p1 = (char *) (a), *_p2 = (char *) (b); \ for (_i = 0; _i < (n); _i ++) *_p1++ = *_p2++; \ } while(0)#define UNALIGNED_(a,b) MOVE_UNALIGNED(a,b,sizeof(*b))char *parse_long_options(int argc, char *argv[], const char *command_name, const char *package, const char *version, void (*usage) (int, char *));void dynamics_usage(int status, char *name);int dynamics_write_pid_file(char *pid_file);int dynamics_fork_daemon(void);unsigned int get_rand32(void);int allow_ipv4_forwarding(void);void check_kernel_support(int options);#define CHECK_KERNEL_ADV_ROUTING 0x01#define CHECK_KERNEL_IPIP 0x02#define CHECK_KERNEL_NETLINK 0x04#define CHECK_KERNEL_GRE 0x08void init_key_extension(struct msg_key *ext, __u16 sub_type, __u32 spi, __u8 keylen);char* ether_hwtoa(unsigned char *addr);int ether_atohw(const char *hwtxt, unsigned char *addr);char* reply_code_str(__u8 code);unsigned int usec_passed(struct timeval *tv, struct timeval *now);unsigned int sec_passed(struct timeval *tv);int cmp_timeval(struct timeval *tv1, struct timeval *tv2);void add_usecs(struct timeval *tv, unsigned int usecs);void set_usecs(struct timeval *tv, unsigned int const usecs);void report_discarded_msg(const char *msg, int len, struct sockaddr_in *from, const char *reason);int get_hex_digit(const char c);size_t dynamics_strlcpy(char *dst, const char *src, size_t size);int ip_checksum(unsigned char *data, int len);struct iphdr;struct udphdr;__u16 udp_checksum(struct iphdr *ip, struct udphdr *udp);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -