📄 binding.h
字号:
/* $Id: binding.h,v 1.49 2001/03/07 19:31:36 jm Exp $ * Mobility bindings used in FAs and HAs. * * 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 BINDING_H#define BINDING_H#include <time.h>#include <sys/types.h>#include <netinet/in.h>#include <net/if.h>#include <sys/time.h>#include <unistd.h>#include "owntypes.h"#include "auth.h"#include "list.h"#include "hashtable.h"/* if timeout if >= INFINITE_TIMEOUT, the binding will not expire */#define INFINITE_TIMEOUT 0xffff/* limits for the binding list and hash so that the binding table does not * require enormous amounts of memory * (these are not hard limits, the binding operations just get slower, if these * are exceeded */#define MAX_BINDING_SHORT_LIST 1500#define MAX_BINDING_HASH 1000/* binding entry */struct bindingkey { struct in_addr mn_addr; struct in_addr ha_addr; __u32 priv_ha; /* 0 = public HA, >0: ha_addr = SHA addr */};struct bindingentry { struct node hashnode; /* entry hashed into hashtable */ struct node timenode; /* entry in the timeout list structure */ int timeout; /* time in seconds when to time out */ /* fields used as the key for the binding */ struct in_addr mn_addr; /* mobile node address */ struct in_addr ha_addr; /* home agent address */ __u32 priv_ha; /* private home agent identifier */ /* the rest of the fields are not used by the binding module itself */ void *data; /* arbitrary user data */ struct in_addr lower_addr; /* other end of the lower tunnel segment */ unsigned short lower_port; /* originating port of lower_addr in * * network byte order */ __u32 id[2]; /* timestamp */ time_t exp_time; /* time when binding will expire */ time_t create_time; /* time when binding was created */ time_t mod_time; /* time when binding was last modified */ unsigned char key[MAX_SK_LEN]; /* the session key for the binding */ int keylen; /* length of the session key */ int spi; /* associated authentication method * * for MN */ struct msg_key *fa_pubkey; /* the public key of the next lower fa */ struct msg_key *last_sent_fa_pubkeyrep; int fa_spi; /* SPI for FA (if fa_keyreq used; * * 0 = not used) */ char tun_dev[IFNAMSIZ]; /* Name of used tunnel device */};struct bindingtable; /* only for internal use in binding.c *//* The following functions will be used as an interface to the mobility * bindings: */struct bindingtable *binding_init(const int maxbindings, const int maxlifetime);void binding_destroy(struct bindingtable *table);int binding_add(struct bindingtable *table, struct bindingentry *entry);struct bindingentry *binding_fetch(struct bindingtable *table, struct bindingkey *key);struct bindingentry *binding_fetch2(struct bindingtable *table, struct in_addr *mn_addr);struct bindingentry *binding_fetch_func(struct bindingtable *table, int (*func)(struct bindingentry *binding));void binding_remove(struct bindingentry *entry);int binding_nextexpiretime(struct bindingtable *table);struct bindingentry *binding_getexpired(struct bindingtable *table, int advance);int binding_iterator(struct bindingtable *table, int (*iterfunc)(struct node *node, void *data), void *data);int binding_update(struct bindingtable *table, struct bindingentry *entry);#endif /* BINDING_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -