📄 api.h.org
字号:
/* api.h -- interface to the libASL library This file is part of libASL. May 24, 2002.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA. *//* Only include this header file once. */#ifndef _API_H_#define _API_H_ 1#include <sys/types.h>/* this is argument to the route_disvovery_done function,* when a route is not found */#define ASL_NO_ROUTE 0#define ASL_ROUTE_FOUND 1// FIXME : could not find sys definition of addr_t. This is temporary.typedef unsigned long addr_t ;struct route_info { /* dest_ip for which route_disocvery needs to be done */ addr_t dest_ip; /* src_ip of the packet. This can be used to determine * if the packet was generated locally */ addr_t src_ip; /* this indicates the protocol type * This is useful for some routing protocols which do different * things based on whether the packet is UDP/TCP/blah. * The protocol is as defined in <netinet/in.h> * So constants like IPPROTO_TCP, IPPROTO_UDP can be used*/ u_int8_t protocol ;};/* __BEGIN_DECLS should be used at the beginning of your declarations, so that C++ compilers don't mangle their names. Use __END_DECLS at the end of C declarations. */#undef __BEGIN_DECLS#undef __END_DECLS#ifdef __cplusplus# define __BEGIN_DECLS extern "C" {# define __END_DECLS }#else# define __BEGIN_DECLS /* empty */# define __END_DECLS /* empty */#endif/* Declarations. Note the wonderful use of the above macros. */__BEGIN_DECLS/* add a route entry to the kernel route table * next_hop = 0 implies that it is a defferred route entry*/introute_add (addr_t dest_ip, addr_t next_hop, char *dev);/* delete a route entry from the kernel route table*/introute_del (addr_t dest_ip);/* returns a file descriptor to stream of asynchrous route request */intopen_route_request (void);/* This function should be called by the routing daemon before it exits.* It takes care of doing all the clean up job.* It returns 0 on success,* -1 if something unexpected occurs */intclose_route_request(int fd);/* blocks until a route request is read from fd* Arguments are the fd returned by open_route_request * and a pointer to a struct route_info.* Fills in the route_info structure.* memory for route_info should be allocated beforehand by the user ;* returns number of bytes read ;* a negative number if there is an error */intread_route_request(int fd, struct route_info *r_info);/* the routing daemon informs the ODRM that route discovery is complete* and the kernel route table has been populated * result argument has two values :* ASL_NO_ROUTE if routing daemon could not find a route,* ASL_ROUTE_FOUND if a route was found for addr_t.* or it wants the packet to be dropped. * returns -1 if there is an error. */int route_discovery_done (addr_t dest_ip, int result);/* return the idle time(in msec) recorded for a destination.* this uses the route_check module */intquery_route_idle_time(addr_t dest_ip);__END_DECLS#endif /* !_API_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -