📄 packet_ops.h
字号:
#ifndef PACKET_OPS_H#define PACKET_OPS_H#include "queue.h"#include "hashtab.h"#include "api.h"#include <sys/types.h>/* initializes the packet_table */intpacket_table_init();/* this function destroys the packet_table and frees all memory* associated with it */intdestroy_packet_table(void);/* add a packet to the packet_table * buf is a complete IP packet* return 0 on success */intpacket_add(unsigned char *buf, unsigned int len);/* sends out all the packets for a given destination* on the raw socket.* and frees the corresponding memory, if result==SUCCESS.* * if result==ASL_NO_ROUTE then the packets are just deleted from the packet_table* if result==ASL_ROUTE_FOUND then the packets are sent on the raw sock** returns 0 if succesful. */intclear_packets(addr_t dest_ip, int result);/* Given a queue, send out all the queued packets on the raw socket* if result == NO_ROUTE then just delete those packets */intsend_all(struct queue *q, int result);/* returns 1 if route disocvery is pending for that destination.* If an entry exists in the hash table, we conclude that route disocvery* is pending */introute_discovery_pending(unsigned char *dest);/* copy the dest_ip address from an IP packet to an array and return it */unsigned char *get_dest_ip(unsigned char *buf);/* copy the src_ip address from an IP packet to an array and return it */unsigned char *get_src_ip(unsigned char *buf);/* return the protocol field from the IP packet */u_int8_tget_protocol(unsigned char *buf);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -