⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buf.h

📁 软件无线电的平台
💻 H
字号:
#ifndef BUF_H__#define BUF_H__#include "ack.h"struct buffer_t {  // This indicates the last packet sent to the kernel.  // It is used when deciding whether a received packet   // is new or just resent because of a lost ack  int ip_buf_rcv_pos;  char *ip_buf_rcv;  int ip_buf_send_pos;  char *ip_buf_send;  // The packets we sent and we're waiting for acks  struct ack *ack_sent;  // The packets we rcvd and we have to confirm  struct ack *ack_rcvd;  // The data we reveived and that has to go to the kernel  struct ack *rcvd;  // The data we have to send  struct ack *send;  // The net-device structure  struct net_device *dev;};/** * @short initialise the buffers * * Initialises enough memory for a couple of IP-packets... * * @param buf where all the stuff shall be stored */void buf_init( struct buffer_t *buf );/** * Clean up the buffers */void buf_cleanup( struct buffer_t *buf ); /** * @short update the references * * When receiving an acknowledge over the air, we can delete some * references from our table... * * @param buf the buffer-structure * @param pack what to remove */void buf_update_ack_sent( struct buffer_t *buf, struct rf_packet *pack );/** * @short inserts a rf-packet in the buffer * * Puts together received data that comes from the rf-interface. * Also inserts acks in the list and calls the kernel-rx  * function if a packet has been received successfully. * * @param buf the buffer-structure * @param pack the received packet */void buf_rf_to_net( struct buffer_t *buf, struct rf_packet *pack );/** * @short prepare a packet over the air * */void buf_net_to_rf( struct buffer_t *buf, char *packet, int len );/** * @short copies b to a with wrap-over in the destination  * * Copies b to a and takes care about an eventual overflow in the * destination block. It then returns the new position. * * @param a destination * @param b source * @param pos the position in the destination * @param len how many bytes * @param wrap the size of the destination * @return the new position in the destination */int buf_copy_wrap_dst( void *a, void *b, int pos, int len, int wrap );/** * @short copies b to a with wrap-over in the source * * Copies b to a and takes care about an eventual overflow in the * source block. It then returns the new position. * * @param a destination * @param b source * @param pos the position in the source * @param len how many bytes * @param wrap the size of the source * @return the new position in the source */int buf_copy_wrap_src( void *a, void *b, int pos, int len, int wrap );#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -