unstuffPkt_User, stuffPkt_User - dynamically adding new packet types
#include "Pkt.h"
int unstuffPkt_User(char *srcname, double ipkttime,
char *bpacket, int nbytes, Packet *pkt)
int stuffPkt_User(Packet *pkt, char *srcname,
double *opkttime, char **bbuf, int *nbytes,
int *szbbuf)
When the Pkt library routines unstuffPkt and stuffPkt encounter
unrecognized packet types, they make a final attempt to decode or
encode the packet using unstuffPkt_User or stuffPkt_User
from libuser.so.
These routines must
accomplish the same things as the routines embedded in libPkt.so,
and in addition must also determine the packet type; the single
routine may potentially decode multiple different packet types.
You might use unstuffPkt_User and/or stuffPkt_User
during initial investigations, as the libuser library can be
dynamically added and removed during execution of programs. In
contrast, you must shut down and restart programs when replacing
libPkt. Note, however, that errors in the libUser routines may
cause programs to die nastily.
unstuffPkt_User is provided with the srcname, the time
ipkttime, and the nbytes bytes of the packet,
bpacket. It must unpack the data in this packet, filling out
the information in the Packet structure pkt. (This pkt
has been initialized to null values).
stuffPkt_User is provided with a Packet structure; the
srcname is created by the caller from pkt->parts.
Otherwise, stuffPkt_User must fill in the value for the pkttime,
must ensure that the output buffer *bbuf is large enough (use
the macro RESIZE_BUFFER(char *, *bbuf, *szbbuf,
required)), and fill in the bytes for the packet properly, returning
the finished size nbytes.
stuffPkt_User must return 0 for success, -1 for failure.
unstuffPkt_User must return the packet content for success, or
-1 for failure. The packet content is one of the following:
Pkt_wf |
waveform packet |
Pkt_st |
status packet |
Pkt_db |
database row |
Pkt_pf |
parameter file |
Pkt_cn |
control messages |
Pkt_rw |
arbitrary binary data, wrapped in orb packet |
Pkt_ch |
arbitrary character string |
Pkt_tp |
test packet |
The code Pkt_st (corresponding to stash packets) must not
be returned by these routines.
libuser.so
unstuffPkt(3), stuffPkt(3), packets.pf(5)
Daniel Quinlan
Table of Contents
Antelope Release 4.8 Darwin 8.8.0 2006-12-19
Boulder Real Time Technologies, Inc
For more information, contact support@brtt.com