arinedif.c:
กก
int streamctrl (char *in, struct keywordlist_t *keywordlist, struct shmbuffarout_t *shmbuffarout)
in is pointed to the buffer of incoming data package, and keywordlist is pointed to a keyworlist_t structure, which contains the key word list for this AR. If the incoming data package is not in our AR's service range, then it will be sent to shmbuffarout, from where it'll be directly forwarded to its destination. If the incoming data package is in service range, then it will put the package in a queue ( the global value pkque defines such queues) by invoking inqueue. Normally, there are more than one queue since AR has to handle more than one stream at a time. In this case, streamctrl will return what inqueue returns --- the queue number that in is put in.
int inqueue (char * incomingbuff)
inqueue is only invoked by streamctrl, when the incomingbuff is in AR's service range. inqueue manages several queues, the exact number of queues is defined by MAXQNum in common.h. One queue for one data stream. When a new data package coming in, either it belongs to a data stream already in the queues, or it is the first package to arrive in its data stream. In the formal case, the package will be put in the queue already there; in the later case, inqueue will make a new queue for the data stream. In either case, the queue number will be returned.
void moveque(int destq, struct shmbuffedit_t * shmbuffedit)
moveque will move a completed queue to API's editing buffer. deskq is the queue number that is completed, shmbuffedit is the share-memory API editing buffer.