comparison rvinterf/localsock.h @ 178:7ab6b29e76bb

rvinterf: forwarding of Rx packets to clients implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 23 Nov 2013 22:15:16 +0000
parents 7f727aaf5cd4
children
comparison
equal deleted inserted replaced
177:fef035264dd4 178:7ab6b29e76bb
3 * socket interface implemented between rvinterf and its clients like fc-tmsh. 3 * socket interface implemented between rvinterf and its clients like fc-tmsh.
4 * 4 *
5 * The UNIX domain sockets used for this ad hoc interface are of the 5 * The UNIX domain sockets used for this ad hoc interface are of the
6 * SOCK_STREAM kind, but the true nature of the communication is message-based. 6 * SOCK_STREAM kind, but the true nature of the communication is message-based.
7 * We use the same trick that is used for DNS over TCP: every message in each 7 * We use the same trick that is used for DNS over TCP: every message in each
8 * direction is preceded by a 2-byte length. This length and all other 8 * direction is preceded by a 2-byte length. This length is sent MSB first
9 * multibyte numbers are sent in the native byte order of the machine on which 9 * just like in DNS over TCP. The limit on the size of these messages
10 * the rvinterf suite is running. The limit on the size of these messages
11 * (for sizing buffers etc) is: 10 * (for sizing buffers etc) is:
12 */ 11 */
13 12
14 #define LOCALSOCK_MAX_MSG 1024 13 #define LOCALSOCK_MAX_MSG 1024
15 14
27 * The first two commands (CLI2RVI_WANT_RVTRACE and CLI2RVI_WANT_MUXPROTO) 26 * The first two commands (CLI2RVI_WANT_RVTRACE and CLI2RVI_WANT_MUXPROTO)
28 * are the means by which client programs inform rvinterf that they are 27 * are the means by which client programs inform rvinterf that they are
29 * interested in receiving copies of certain packets coming from the target. 28 * interested in receiving copies of certain packets coming from the target.
30 * 29 *
31 * The CLI2RVI_WANT_RVTRACE opcode needs to be followed by a USEID mask value 30 * The CLI2RVI_WANT_RVTRACE opcode needs to be followed by a USEID mask value
32 * and a USEID match value, both in the native byte order of the machine 31 * and a USEID match value, both in the network byte order, i.e., MSB first,
33 * running rvinterf, for a total message length of 9 bytes. For every RV 32 * for a total message length of 9 bytes. For every RV trace message received
34 * trace message received from the target, rvinterf will iterate through all 33 * from the target, rvinterf will iterate through all active clients to see who
35 * active clients to see who is interested: if the received USEID ANDed with 34 * is interested: if the received USEID ANDed with the mask equals the match
36 * the mask equals the match value, the message will be forwarded to that 35 * value, the message will be forwarded to that client.
37 * client.
38 * 36 *
39 * The CLI2RVI_WANT_MUXPROTO opcode needs to be followed by one byte 37 * The CLI2RVI_WANT_MUXPROTO opcode needs to be followed by one byte
40 * identifying the RVTMUX protocol of interest, i.e., the first byte of the 38 * identifying the RVTMUX protocol of interest, i.e., the first byte of the
41 * packets exchanged between the host and the target, e.g., 0x12 for L1 traces 39 * packets exchanged between the host and the target, e.g., 0x12 for L1 traces
42 * as defined in pktmux.h, for a total message length of 2 bytes. 40 * as defined in pktmux.h, for a total message length of 2 bytes.