O2 1.2
Inter-process communication system for media applications
Data Fields
o2_message Struct Reference

an O2 message container More...

#include <o2.h>

Data Fields

union {
   struct o2_message *   next
 links used for free list and scheduler
 
   int64_t   pad_if_needed
 make sure allocated is 8-byte aligned
 
}; 
 
union {
   int   tcp_flag
 send message by tcp?
 
   int64_t   pad_if_needed2
 make sure allocated is 8-byte aligned
 
}; 
 
int32_t allocated
 how many bytes allocated in data part
 
int32_t length
 the length of the message in data part
 
o2_msg_data data
 

Detailed Description

an O2 message container

Note: This struct represents an O2 message that is stored on the heap. The length field must preceded data with no padding (see o2_msg_data declaration and the note that precedes it). To make sure there is no padding between length and data, we force the next pointer to occupy 8 bytes even if this is a 32-bit machine by making it part of a union with an 8-byte int64_t field named "pad_if_needed."

Note that o2_messages are on the heap and can be allocated, scheduled, sent, and freed. In contrast, o2_msg_data structures are contained within o2_messages and are passed to method handlers, but cannot be allocated, scheduled, sent, or freed. They are always the data field of a containing o2_message.


The documentation for this struct was generated from the following file: