Inband-related Buffers (CMD, RPL, and TX2)
|Top Previous Next|
Three buffers are required for inband message processing. On startup, these buffers are not allocated any memory, so you have to do it if you are planning to send and receive inband messages.
•The CMD buffer- used to store incoming inband messages (we call them "inband commands"). Use the sock.cmdbuffrq method to allocate memory for this buffer. Usually, inband commands are not very long so allocating a minimum space of 1 page is typically sufficient.
•The RPL buffer- used to store outgoing inband messages (we call them "inband replies"). Use the sock.rplbuffrq method to allocate memory for this buffer. again, inband commands are usually not very long so allocating a minimum space of 1 page will probably be sufficient.
•The TX2 buffer- used internally by the socket when inband commands are enabled. You don't have to do anything with this buffer other than allocate memory for it. We recommend allocating as much space as you did for the TX buffer. Allocation is requested through the sock.tx2buffrq method.
Actual memory allocation is done through the sys.buffalloc method which applies to all buffers previously specified. Here is an example:
Actual memory allocation takes up to 100ms, so it is usually done just once, on boot, for all required buffers.
You may not always get the full amount of memory you have requested. Memory is not an infinite resource, and if you have already requested (and received) allocations for 95% of the memory for your platform, your next request will get up to 5% of memory, even if you requested for 10%.
There is a small overhead for each buffer. Meaning, not 100% of the memory allocated to a buffer is actually available for use. A certain number of bytes in each buffer is reserved for variables needed to administer this buffer. This number is 17 for 16-bit platforms and 33 for 32-bit platforms. Platform type is specified in your platform documentation.
Thus, if we requested (and received) a buffer with 2 pages (256 * 2 = 512), then we can only store 512 - 16 or 512 - 32 bytes in this buffer, depending on the platform type.