GNUradio tools for packet-switched transmission(message source 和message sink)

 

Packet-switching in GNUradio

  • In packet-switched transmission, packets of data arrive asynchronously from the data source on the transmit side and from the USRP on the receive side.
  • In order to accommodate the asynchronous nature of packet-switched transmission in the signal flow graph operation of GNUradio:
    1. Special source and sink blocks that contain buffers to hold packets are needed.
    2. Provisions for inserting packets into and extracting packets from the buffers in the source and sink blocks are needed.
    3. The flow graph needs to be halted when the buffers are empty, and packets may need to be discarded when the buffers are full.

Message and message queue classes

  • The GNUradio gr_message and
    gr_msq_queue classes provide the underlying buffering support for packet-switched source and sink blocks.

Message

  • A message is a gr_message class object, which is constructed by providing thetype
    (0=data,1=EOF), 2 optional arguments (arg1 andarg2), and
    length of the message.
  • The following methods are provided to set the contents and access the various parameters of a message object:
    • gr_make_message_from_string (const std::string s, long type, double arg1, double arg2)
    • to_string(): returns the message string
    • set_type(long type) and
      type()
    • set_arg1(long arg1) and
      arg1()
    • set_arg2(long arg1) and
      arg2()
    • length()
    • msq(): returns a pointer to the message string

Message queue

  • A message queue is a gr_msg_queue class object, which is a linked list of
    message objects. The maximum length limit of a message queue is set when constructing the queue.
  • Thread synchronizing access to a message queue is provided by the following two methods:
    • insert_tail(gr_message_sptr msg): inserts the messagemsq into the tail of the queue if queue is not full; otherwise waits until some messages are removed from
      the queue by other threads.
    • delete_head(): greps a message from the head of the queue if queue is not empty; otherwise waits until some messages are inserted into the queue by other threads.
  • Other methods (no thread synchronization) are also provided to manage a message queue:
    • flush(): deletes all messages from the queue
    • empty_p(): is the queue empty?
    • full_p(): is the queue full?
    • count(): returns number of messages in queue
    • limit(): returns the maximum queue length

Transmit side operations

  • Use the GNUradio message source block gr_message_source to create a new
    message queue (or use an existing queue).
  • The message source block extracts messages from the queue to provide a character stream to the next block in the signal flow graph until it encounters an EOF message (type=-1). It waits (halts the output
    character stream) when the queue is empty.
  • The message source block provides the method msgq() to expose the message queue. Users can employ theinsert_tail() method of exposed message queue to add packets
    to the queue asynchronously.
  • The set of python programs starting at the top level with
    benchmark_tx.py in the directory$GR_INSTALL/share/gnuradio/examples/digital
    illustrates how to perform packet-switched transmission using the message source block.

Receive side operations

  • On the receive side, since the packet arrival process is not known in advance, one must search for packets from the received signal samples obtained from the USRP. This means:

    • One must continuously perform carrier sensing, carrier synchronization, symbol synchronization, and demodulation (assuming high SNR), and then acquisition to extract packets from the USRP signal samples.
    • The packet extraction function may be performed in a GNUradio sink block, which should also insert the extracted packets to a message queue. An example of such a sink block is the GNUradio blockgr_framer_sink_1.
    • A separate process is needed to monitor the message queue. The process should initiate acallback when a packet is inserted into the queue by the sink block. This can be achieved by using the thread-synchronizing
      message queue access methoddelete_head() in the monitoring process.
  • The set of python programs starting at the top level with
    benchmark_rx.py in the directory$GR_INSTALL/share/gnuradio/examples/digital
    illustrates how to perform packet-switched reception using the framer sink blockgr_framer_sink_1 and the message queue class.
时间: 2024-10-26 08:01:51

GNUradio tools for packet-switched transmission(message source 和message sink)的相关文章

问题解决了!!请删除~~message.from 和message.conversationchatter一样怎么办

问题描述 群聊下,头像设置,我想通过message.from 和message.conversationchatter来判断是群组的头像还是个人的但是我获取message.from 的时候和message.conversation 一样,都是群组号码,这样我没办法判断头像啊,怎么办 解决方案 群消息里面可以根据这个属性判断:/*! @property @brief 群聊消息里的发送者用户名 */@property (nonatomic, copy) NSString *groupSenderNa

41.2. iptables - administration tools for packet filtering and NAT

Incoming Traffic | | V +----------+ |PREROUTING| +----------+ | raw | <--------------+ | mangle | | | nat | | +----------+ | | | | | Routing | +- Decision -+ | | | | | | | V V | Local Remote | Destination Destination | | | | | | | V V | +--------+ +-

Code a network packet sniffer in python for Linux

Basic Sniffer The most basic form of a sniffer would be : 1 #Packet sniffer in python 2 #For Linux 3   4 import socket 5   6 #create an INET, raw socket 7 s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP) 8   9 # receive a packet

Reliable and Fast Messaging and Notification Services Using Alibaba Cloud Message Service for Android

By Sai Sarath Chandrap Alibaba Cloud Tech Share Author This is a sample project created to demonstrate the usage of Alibaba Cloud Message Service on Android. This application shows the capability of the Message Service for messaging and notification

关于JMS Message Pending的问题

前段时间,有同事跟我说客户那边有很多状态为receive的message,这些message只有在JMS Server或 weblogic Server充启之后才能被消费.经过调查后,这个问题可能是weblogic的一个bug,当然也不排除 跟具体环境有关的可能.下面我们来看看问题的根本原因是什么,这种分析有助我们更进一步理解 weblogic JMS的实现. 首先我们看一下什么是receive,receive表示一个message已经被consumer消费,但服务端还没有关于 这个messag

WCF后续之旅(13) 创建一个简单的WCF SOAP Message拦截、转发工具

WCF是.NET平台下实现SOA的一种手段,SOA的一个重要的特征就基于Message的通信方式.从Messaging的角度讲,WCF可以看成是对Message进行发送.传递.接收.基础的工具.对于一个消息交换的过程,很多人只会关注message的最初的发送端和最终的接收端.实际上在很多情况下,在两者之间还存在很多的中间结点(Intermediary),这些中间结点在可能在实际的应用中发挥中重要的作用.比如,我们可以创建路由器(Router)进行消息的转发,甚至是Load Balance:可以创

Http Message结构学习总结

最近做的东西需要更深入地了解Http协议,故死磕了一下RFC2616-HTTP/1.1协议,主要是了解Http Message结构及每部分含义,在此总结一下,并打算写一个模拟发送HTTP请求的工具,明天写完再附上 来:> (注:下面如"(14.1)"表示是在RFC2616第14章第1节有更详细的介绍) 一.Http Message结构 了解Http Message先看下图: Http Message包含3个部分: (1).请求行/状态行 (2).消息头(Message Heade

关于weblogic中jms message的状态

今天同事问我说,如何处理RECEIVE.VISIBLE的JMS消息?有点懵,之前从没有关注过消息的状态.Weblogic81中,我们是不能看到 destination中的消息的,只能看到当前destination中,有多少message, 有多少pending的message.而92中,我们监控destination的时候,可以看到具体的message,而且message后面会跟一个state string.标题中说的RECEIVE.VISIBLE就是这个state string,其实state

.NET Compact Framework下的进程间通信之Windows Message

在Wince和Windows Moblie 下的进程间通信可以由以下几种技术实现. 1. Windows Message 2. Point-to-Point Message Queues 3. MSMQ 下面使用讲述.NET Compact Framework下使用Windows Message进行进程间的 通信. 引用库 在CF.net下进行Windows Message的开发需要引用Microsoft.WindowsCE.Forms ,该DLL一般存放于C:\Program Files\Mi