📄 sha.h
字号:
/* $Id: sha.h,v 1.3 2001/06/23 22:23:51 jm Exp $ * Header files for Surrogate Home Agent * * Dynamic hierarchial IP tunnel * Copyright (C) 2000-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 SHA_H#define SHA_H#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <asm/types.h>#include <net/if.h>#include <netinet/in.h>#include <sys/time.h>#include "binding.h"#include "message.h"#include "msgparser.h"#define DEBUG_FLAG 'W'#define DEBUG_FLAG2 'w'#define LOG2(lev, fmt, args...) do { DEBUG(DEBUG_FLAG, fmt, ## args); \ syslog(lev, fmt, ## args); } while(0)/* The process id of the daemon is saved here to make it easier to kill the correct daemon when necessary. */#define SHA_PID_FILE PIDDIR "/dynshad.pid"#define MAXMSG 2048/* the unconfirmed request data can be deleted after it is older than * UNCONFIRMED_TIMEOUT seconds */#define UNCONFIRMED_TIMEOUT 15#define TRUE 1#define FALSE 0/* if there is more than one unconfirmed request or unconfirmed * requests to a confirmed binding, then the request data is saved in * unconfirmed_request structures and the correct one will be used * after the HA's reply is received */struct unconfirmed_request { struct unconfirmed_request *next; time_t created; /* creation time */ struct in_addr lower_addr; /* the address where this request came from */ unsigned short lower_port; /* the source port of the req. */ __u32 id[2]; /* id field from the req. */ int spi; /* MN spi */ struct in_addr ha_addr; /* Home Agent address from the req. */ int timeout; int tunnel_type; __u32 tunnel_key; struct msg_key *fa_pubkey; /* HFA pubkey or NULL=use fa_spi */ int fa_spi; /* HFA SPI for session key encryption */ __u32 nonce; /* nonce value sent to HA */};struct tunnel_data { struct unconfirmed_request *unc_req; /* list of unconfirmed req. */ int req_lifetime; /* lifetime used in the request */ char ha_tun_dev[IFNAMSIZ]; /* device for the HA tunnel in * the highest FA */ int confirmed; /* confirmed binding = 1, unconfirmed = 0 */ int up_type, down_type; /* TUNNEL_IPIP / TUNNEL_GRE */ __u32 up_key, down_key; /* GRE tunnel key - to upper/lower FA */ struct tunnel *up_tunl; struct tunnel *down_tunl;};struct sha_spi_entry *get_sha_spi(int spi, struct in_addr addr, __u32 id);#if 0/* function prototypes - fa_utils.c */int send_address_ok(struct in_addr to_addr);int own_sendto(int sock, struct in_addr to_addr, unsigned int to_port, void *data, int len);void close_socket(int fd);void free_unconfirmed_data(struct unconfirmed_request *unc);void free_binding(struct bindingentry *binding, int *count);int eliminate_binding_entry(struct node *node, void *data);int eliminate_binding_entry_force(struct node *node, void *data);int update_binding(struct bindingtable *hash, struct bindingentry *binding, int *count);struct bindingentry *make_new_binding(struct bindingtable *bhash, struct msg_extensions *ext, struct sockaddr_in cli_addr, int max_lifetime);int equal_pubkey(struct msg_key *key1, struct msg_key *key2);int do_rsa_decrypt(struct msg_key *keyrep, unsigned char *sk, int sk_len);int create_tunnels(struct bindingentry *binding, struct hashtable *thash, struct fa_config *config, int highest_FA);int check_confirmed_data(struct bindingentry *binding, struct msg_extensions *ext);struct unconfirmed_request *add_unconfirmed_data(struct bindingtable *bhash, int *bindingcount, struct bindingentry *binding, struct msg_extensions *ext, struct sockaddr_in cli_addr, struct in_addr dst_addr, struct interface_entry *iface, struct fa_config *config);void unconfirmed_to_binding(struct bindingentry *binding, struct unconfirmed_request *unc);void check_unconfirmed_timeout(struct bindingentry *binding);void remove_binding_tunnels(struct bindingentry *binding, struct hashtable *thash, int highest_FA, int *bindingcount);void check_bindings(struct bindingtable *bhash, struct hashtable *thash, int highest_FA, int *bindingcount, time_t now);#endif/* sha_request.c */void handle_request(char *msg, int len, struct msg_extensions *ext, struct sockaddr_in *addr);/* sha_reply.c */void handle_reply(char *msg, int len, struct msg_extensions *ext, struct sockaddr_in *addr);#endif /* SHA_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -