[Tinyos-devel] Current status of the message buffer discussion

Jan Hauer jan.hauer at gmail.com
Tue Jun 2 03:38:28 PDT 2009


Here are some example interfaces that you could use with my proposal:

interface Receive
{
  // Receive is protocol-independent
  event packet_t* receive(packet_t* packet);
}

interface Send
{
  // This is an address/parameter-free send
  command error_t send(packet_t* packet);
  command error_t cancel(packet_t* packet);
  event void sendDone(packet_t* packet, error_t error);
}

interface XYSend
{
  // This is a protocol-specific Send interface
  command error_t xysend(packet_t* packet, xy_address_t dest, uint16_t xyflags);
  command error_t cancel(packet_t* packet);
  event void xysendDone(packet_t* packet, error_t error);
}


// The "Packet" interface is provided by a library component,
// e.g. by tos/lib/PacketP.nc (not by a protocol component)
interface Packet
{
  // @return the *current* length of the packet; the value
  // will change as the packet moves up/down the stack
  command uint8_t getPacketLength(packet_t* packet);

  // attaches a new header to the front of the packet (packet length will grow)
  command void* allocHeader(packet_t* packet, uint8_t headerLen);

  // @return a pointer to the current header, i.e. front of the
  // packet (packet length will not change)
  command void* getHeader(packet_t* packet);

  // removes the current header (packet length will shrink)
  command void* freeHeader(packet_t* packet, uint8_t headerLen);

  // similar for footers ...
  command void* allocFooter(packet_t* packet, uint8_t footerLen);
  command void* getFooter(packet_t* packet, uint8_t footerLen);
  command void* freeFooter(packet_t* packet, uint8_t footerLen);
}

The Packet interface could also include other commands like
resizeHeader() or getPacketCopy(uint8_t* buffer, uint8_t bufLen), etc.
If we also follow the way I want to deal with metadata, then the
Send/Receive interfaces would have an additional command
getMetadata():

  // getMetadata() works like the original Packet.getPayload():
  // the offset where the metadata region starts within a packet
  // is fixed, i.e. for a given packet this command will always
  // return the same pointer or NULL.
  command void* getMetadata(packet_t* packet, uint8_t len);

Jan

On Mon, Jun 1, 2009 at 3:49 PM, Omprakash Gnawali <gnawali at usc.edu> wrote:
> We discussed these interfaces during net2 meeting last week. Option 3
> might be problematic because something like blip might need support
> for multiple addressing modes.
>
> - om_p
>
> On Fri, May 22, 2009 at 2:43 PM, Miklos Maroti <mmaroti at math.u-szeged.hu> wrote:
>> Dear Eric,
>>
>> You brought up very good points, and I am very happy that others are
>> also engaged in the discussion. At this point I am convinced that both
>> Jan's and my proposals could be made to work. But to really compare
>> the two approaches we need use cases, very well defined used cases.
>>
>> Just to start the discussion, let me start with IEEE 802.15.4 link
>> layer. Here are some options:
>>
>> ------- Option #1 -------
>>
>> interface Ieee154Send
>> {
>>        command error_t send64(uint64_t dest, bool ackReq, message_t* msg);
>>        command error_t send16(uint16_t dest, bool ackReq, message_t* msg);
>>        event void sendDone(message_t* msg, error_t error, bool acked);
>>        command void* getPayload(message_t* msg, uint8_t len);
>> }
>>
>> interface Ieee154Packet
>> {
>>        command uint16_t getSource16(message_t* msg);
>>        command uint64_t getSource64(message_t* msg);
>>        command uint16_t getDestination16(message_t* msg);
>>        command uint64_t getDestination64(message_t* msg);
>>        // no set commands as this interface should be used only for
>> received messages
>>
>>        command void* getPayload(message_t* msg);
>>        command uint8_t getLength(message_t* msg);
>> }
>>
>> ------- Option #2 -------
>>
>> enum ieee154_flags
>> {
>>        IEEE154_ACK_REQ = 1 << 0,
>>        IEEE154_FRAME_PENDING = 1 << 1,
>>        IEEE154_COMPRESS_TO_16BIT = 1 << 2,
>> };
>>
>> interface Ieee154Send
>> {
>>        command error_t send(uint64_t dest, uint8_t flags, message_t* msg,
>> void* payload, uint8_t length);
>>        event void sendDone(message_t* msg, error_t error, uint8_t flags);
>>        command void* getPayload(message_t* msg, uint8_t len);
>>        command uint8_t getMaxPayload();
>> }
>>
>> interface Ieee154Receive
>> {
>>        event message_t* receive(uint64_t source, message_t* msg, void*
>> payload, uint8_t length);
>> }
>>
>> ------- Option #3 -------
>>
>> #ifdef USE_64BIT_ADDR
>> typedef uint64_t address_t;
>> #else
>> typedef uint16_t address_t;
>> #endif
>>
>> interface Ieee154Packet
>> {
>>        command void format(message_t* msg, uint8_t flags);
>>
>>        command address_t getSource(message_t* msg);
>>        command address_t getDestination(message_t* msg);
>>        command void setSource(message_t* msg, address_t addr);
>>        command void setDestination(message_t* msg, address_t addr);
>>
>>        command void requestAck(message_t* msg, bool ack);
>>        command bool wasAcknowledged(message_t* msg);
>>
>>        command void* payload(message_t* msg);
>>        command uint8_t payloadLength(message_t* msg);
>>        command void setPayloadLength(message_t* msg, uint8_t len);
>>        command uint8_t maxPayloadLength(message_t* msg);
>> }
>>
>> interface Send
>> {
>>        command error_t send(message_t* msg);
>>        event void sendDone(message_t* msg, error_t error);
>> }
>>
>> interface Receive
>> {
>>        event message_t* receive(message_t* msg);
>> }
>>
>> Miklos
>>
>> _______________________________________________
>> Tinyos-devel mailing list
>> Tinyos-devel at millennium.berkeley.edu
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel
>>
>
> _______________________________________________
> Tinyos-devel mailing list
> Tinyos-devel at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel
>



More information about the Tinyos-devel mailing list