# HG changeset patch # User Michael Spacefalcon # Date 1391490237 0 # Node ID 2f285f20d617f24032ab4e57a1d5b99c23e96f53 # Parent c33fb341faeb682a1e2390b662095a5f40abe9d8 rvinterf: *.h moved into include subdir diff -r c33fb341faeb -r 2f285f20d617 rvinterf/etm/abb.c --- a/rvinterf/etm/abb.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/etm/abb.c Tue Feb 04 05:03:57 2014 +0000 @@ -7,8 +7,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" #include "localtypes.h" #include "etm.h" diff -r c33fb341faeb -r 2f285f20d617 rvinterf/etm/etmbasic.c --- a/rvinterf/etm/etmbasic.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/etm/etmbasic.c Tue Feb 04 05:03:57 2014 +0000 @@ -7,8 +7,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" #include "etm.h" extern u_char rvi_msg[]; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/etm/init.c --- a/rvinterf/etm/init.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/etm/init.c Tue Feb 04 05:03:57 2014 +0000 @@ -10,8 +10,8 @@ #include #include #include -#include "../pktmux.h" -#include "../localsock.h" +#include "../include/pktmux.h" +#include "../include/localsock.h" extern char *socket_pathname; extern int sock; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/etm/interf.c --- a/rvinterf/etm/interf.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/etm/interf.c Tue Feb 04 05:03:57 2014 +0000 @@ -6,7 +6,7 @@ #include #include #include -#include "../localsock.h" +#include "../include/localsock.h" extern int sock; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/etm/pktsort.c --- a/rvinterf/etm/pktsort.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/etm/pktsort.c Tue Feb 04 05:03:57 2014 +0000 @@ -7,9 +7,9 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" -#include "../localsock.h" +#include "../include/pktmux.h" +#include "../include/limits.h" +#include "../include/localsock.h" #include "localtypes.h" #include "etm.h" diff -r c33fb341faeb -r 2f285f20d617 rvinterf/etm/tmcore.c --- a/rvinterf/etm/tmcore.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/etm/tmcore.c Tue Feb 04 05:03:57 2014 +0000 @@ -8,8 +8,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" #include "localtypes.h" #include "etm.h" diff -r c33fb341faeb -r 2f285f20d617 rvinterf/include/limits.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/include/limits.h Tue Feb 04 05:03:57 2014 +0000 @@ -0,0 +1,32 @@ +/* + * For sizing our buffers etc in the rvinterf suite, including the local + * UNIX domain socket protocol between rvinterf and fc-tmsh etc, we need + * to have some limits on the message sizes in both host->target and + * target->host directions. + * + * For the host->target direction, the choice of message size limit is + * easy: the packet Rx code in RVT on the target side also has a limit + * (quite naturally, as it needs to use a static buffer to reassemble + * incoming packets as they arrive at the UART in unpredictable interrupt- + * sized chunks), so we set our limit to match that in RVT. + */ + +#define MAX_PKT_TO_TARGET 255 + +/* + * In the other direction (target->host), there is no fixed limit + * definition easily visible in the target fw code: any fw component + * can call rvt_send_trace_cpy() or rvt_mem_alloc() followed by + * rvt_send_trace_no_cpy(), or some higher-level API that reduces to + * these functions, with a message of any size, subject only to memory + * limits, which obviously aren't as strict as a #define'd maximum + * message size. Hence in this direction we use our own arbitrary + * choice of size limit. + */ + +#define MAX_PKT_FROM_TARGET 512 + +/* + * Both limit definitions above counts all bytes between the opening and + * closing STX flags, but not DLEs inserted for binary transparency. + */ diff -r c33fb341faeb -r 2f285f20d617 rvinterf/include/localsock.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/include/localsock.h Tue Feb 04 05:03:57 2014 +0000 @@ -0,0 +1,71 @@ +/* + * This header defines and describes (through comments) the local UNIX domain + * socket interface implemented between rvinterf and its clients like fc-tmsh. + * + * The UNIX domain sockets used for this ad hoc interface are of the + * SOCK_STREAM kind, but the true nature of the communication is message-based. + * We use the same trick that is used for DNS over TCP: every message in each + * direction is preceded by a 2-byte length. This length is sent MSB first + * just like in DNS over TCP. The limit on the size of these messages + * (for sizing buffers etc) is: + */ + +#define LOCALSOCK_MAX_MSG 1024 + +/* + * Each message in the client->rvinterf direction (can be seen as command) + * begins (after the length) with an opcode byte as follows: + */ + +#define CLI2RVI_WANT_RVTRACE 0x00 +#define CLI2RVI_WANT_MUXPROTO 0x01 +#define CLI2RVI_PKT_TO_TARGET 0x02 +#define CLI2RVI_RAWBYTES_TO_TARGET 0x03 + +/* + * The first two commands (CLI2RVI_WANT_RVTRACE and CLI2RVI_WANT_MUXPROTO) + * are the means by which client programs inform rvinterf that they are + * interested in receiving copies of certain packets coming from the target. + * + * The CLI2RVI_WANT_RVTRACE opcode needs to be followed by a USEID mask value + * and a USEID match value, both in the network byte order, i.e., MSB first, + * for a total message length of 9 bytes. For every RV trace message received + * from the target, rvinterf will iterate through all active clients to see who + * is interested: if the received USEID ANDed with the mask equals the match + * value, the message will be forwarded to that client. + * + * The CLI2RVI_WANT_MUXPROTO opcode needs to be followed by one byte + * identifying the RVTMUX protocol of interest, i.e., the first byte of the + * packets exchanged between the host and the target, e.g., 0x12 for L1 traces + * as defined in pktmux.h, for a total message length of 2 bytes. + * + * The last two commands (CLI2RVI_PKT_TO_TARGET and CLI2RVI_RAWBYTES_TO_TARGET) + * cause data payload to be sent to the target serial port. Payload following + * CLI2RVI_PKT_TO_TARGET (must not exceed MAX_PKT_TO_TARGET) is sent with the + * proper packet encapsulation per TI; bytes following + * CLI2RVI_RAWBYTES_TO_TARGET are sent raw. + */ + +/* + * Each message in the rvinterf->client direction begins (after the length) + * with a message type byte as follows: + */ + +#define RVI2CLI_PKT_FROM_TARGET 0x00 +#define RVI2CLI_LOCAL_CMD_RESP 0x01 + +/* + * Messages beginning with RVI2CLI_PKT_FROM_TARGET are packets received + * from the target GSM device; the byte following this type code is the + * first byte of the packet from the target, e.g., 0x11 for RV traces or + * 0x12 for L1 traces. Rvinterf will only start sending these messages + * to a client after that client has expressed interest in receiving + * target->host packets of a particular type. + * + * Messages beginning with RVI2CLI_LOCAL_CMD_RESP are generated locally + * by rvinterf itself as responses to commands, currently as responses to + * CLI2RVI_WANT_{RVTRACE,MUXPROTO}. The byte following the + * RVT2CLI_LOCAL_CMD_RESP type code is ASCII '+' or ASCII '-', indicating + * success or error, respectively. Any remaining bytes form a message + * for the user. + */ diff -r c33fb341faeb -r 2f285f20d617 rvinterf/include/pktmux.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/include/pktmux.h Tue Feb 04 05:03:57 2014 +0000 @@ -0,0 +1,16 @@ +/* + * Definitions for the RVT MUX over-the-wire protocol + */ + +#define STX 0x02 +#define DLE 0x10 + +#define RVT_RV_HEADER 0x11 +#define RVT_L1_HEADER 0x12 +#define RVT_L23_HEADER 0x13 +#define RVT_TM_HEADER 0x14 +#define RVT_RNET_HEADER 0x15 +#define RVT_PROF_HEADER 0x16 +#define RVT_GTTBACK_HEADER 0x17 +#define RVT_OTHER_HEADER 0x18 +#define RVT_INVALID_HEADER 0xFF diff -r c33fb341faeb -r 2f285f20d617 rvinterf/limits.h --- a/rvinterf/limits.h Mon Feb 03 06:35:29 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * For sizing our buffers etc in the rvinterf suite, including the local - * UNIX domain socket protocol between rvinterf and fc-tmsh etc, we need - * to have some limits on the message sizes in both host->target and - * target->host directions. - * - * For the host->target direction, the choice of message size limit is - * easy: the packet Rx code in RVT on the target side also has a limit - * (quite naturally, as it needs to use a static buffer to reassemble - * incoming packets as they arrive at the UART in unpredictable interrupt- - * sized chunks), so we set our limit to match that in RVT. - */ - -#define MAX_PKT_TO_TARGET 255 - -/* - * In the other direction (target->host), there is no fixed limit - * definition easily visible in the target fw code: any fw component - * can call rvt_send_trace_cpy() or rvt_mem_alloc() followed by - * rvt_send_trace_no_cpy(), or some higher-level API that reduces to - * these functions, with a message of any size, subject only to memory - * limits, which obviously aren't as strict as a #define'd maximum - * message size. Hence in this direction we use our own arbitrary - * choice of size limit. - */ - -#define MAX_PKT_FROM_TARGET 512 - -/* - * Both limit definitions above counts all bytes between the opening and - * closing STX flags, but not DLEs inserted for binary transparency. - */ diff -r c33fb341faeb -r 2f285f20d617 rvinterf/localsock.h --- a/rvinterf/localsock.h Mon Feb 03 06:35:29 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * This header defines and describes (through comments) the local UNIX domain - * socket interface implemented between rvinterf and its clients like fc-tmsh. - * - * The UNIX domain sockets used for this ad hoc interface are of the - * SOCK_STREAM kind, but the true nature of the communication is message-based. - * We use the same trick that is used for DNS over TCP: every message in each - * direction is preceded by a 2-byte length. This length is sent MSB first - * just like in DNS over TCP. The limit on the size of these messages - * (for sizing buffers etc) is: - */ - -#define LOCALSOCK_MAX_MSG 1024 - -/* - * Each message in the client->rvinterf direction (can be seen as command) - * begins (after the length) with an opcode byte as follows: - */ - -#define CLI2RVI_WANT_RVTRACE 0x00 -#define CLI2RVI_WANT_MUXPROTO 0x01 -#define CLI2RVI_PKT_TO_TARGET 0x02 -#define CLI2RVI_RAWBYTES_TO_TARGET 0x03 - -/* - * The first two commands (CLI2RVI_WANT_RVTRACE and CLI2RVI_WANT_MUXPROTO) - * are the means by which client programs inform rvinterf that they are - * interested in receiving copies of certain packets coming from the target. - * - * The CLI2RVI_WANT_RVTRACE opcode needs to be followed by a USEID mask value - * and a USEID match value, both in the network byte order, i.e., MSB first, - * for a total message length of 9 bytes. For every RV trace message received - * from the target, rvinterf will iterate through all active clients to see who - * is interested: if the received USEID ANDed with the mask equals the match - * value, the message will be forwarded to that client. - * - * The CLI2RVI_WANT_MUXPROTO opcode needs to be followed by one byte - * identifying the RVTMUX protocol of interest, i.e., the first byte of the - * packets exchanged between the host and the target, e.g., 0x12 for L1 traces - * as defined in pktmux.h, for a total message length of 2 bytes. - * - * The last two commands (CLI2RVI_PKT_TO_TARGET and CLI2RVI_RAWBYTES_TO_TARGET) - * cause data payload to be sent to the target serial port. Payload following - * CLI2RVI_PKT_TO_TARGET (must not exceed MAX_PKT_TO_TARGET) is sent with the - * proper packet encapsulation per TI; bytes following - * CLI2RVI_RAWBYTES_TO_TARGET are sent raw. - */ - -/* - * Each message in the rvinterf->client direction begins (after the length) - * with a message type byte as follows: - */ - -#define RVI2CLI_PKT_FROM_TARGET 0x00 -#define RVI2CLI_LOCAL_CMD_RESP 0x01 - -/* - * Messages beginning with RVI2CLI_PKT_FROM_TARGET are packets received - * from the target GSM device; the byte following this type code is the - * first byte of the packet from the target, e.g., 0x11 for RV traces or - * 0x12 for L1 traces. Rvinterf will only start sending these messages - * to a client after that client has expressed interest in receiving - * target->host packets of a particular type. - * - * Messages beginning with RVI2CLI_LOCAL_CMD_RESP are generated locally - * by rvinterf itself as responses to commands, currently as responses to - * CLI2RVI_WANT_{RVTRACE,MUXPROTO}. The byte following the - * RVT2CLI_LOCAL_CMD_RESP type code is ASCII '+' or ASCII '-', indicating - * success or error, respectively. Any remaining bytes form a message - * for the user. - */ diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/clientcmd.c --- a/rvinterf/lowlevel/clientcmd.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/clientcmd.c Tue Feb 04 05:03:57 2014 +0000 @@ -8,9 +8,9 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" -#include "../localsock.h" +#include "../include/pktmux.h" +#include "../include/limits.h" +#include "../include/localsock.h" #include "client.h" void diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/format.c --- a/rvinterf/lowlevel/format.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/format.c Tue Feb 04 05:03:57 2014 +0000 @@ -7,8 +7,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" extern u_char rxpkt[]; extern size_t rxpkt_len; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/format_g23.c --- a/rvinterf/lowlevel/format_g23.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/format_g23.c Tue Feb 04 05:03:57 2014 +0000 @@ -12,8 +12,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" extern u_char rxpkt[]; extern size_t rxpkt_len; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/localsock.c --- a/rvinterf/lowlevel/localsock.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/localsock.c Tue Feb 04 05:03:57 2014 +0000 @@ -10,7 +10,7 @@ #include #include #include -#include "../localsock.h" +#include "../include/localsock.h" #include "client.h" int listener; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/logsent.c --- a/rvinterf/lowlevel/logsent.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/logsent.c Tue Feb 04 05:03:57 2014 +0000 @@ -6,7 +6,7 @@ #include #include #include -#include "../limits.h" +#include "../include/limits.h" log_sent_packet(pkt, pktlen) u_char *pkt; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/packetrx.c --- a/rvinterf/lowlevel/packetrx.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/packetrx.c Tue Feb 04 05:03:57 2014 +0000 @@ -6,8 +6,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" extern int target_fd; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/packettx.c --- a/rvinterf/lowlevel/packettx.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/packettx.c Tue Feb 04 05:03:57 2014 +0000 @@ -9,8 +9,8 @@ #include #include #include -#include "../pktmux.h" -#include "../limits.h" +#include "../include/pktmux.h" +#include "../include/limits.h" extern int target_fd; extern int wakeup_after_sec; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/pktfwd.c --- a/rvinterf/lowlevel/pktfwd.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/pktfwd.c Tue Feb 04 05:03:57 2014 +0000 @@ -9,8 +9,8 @@ #include #include #include -#include "../pktmux.h" -#include "../localsock.h" +#include "../include/pktmux.h" +#include "../include/localsock.h" #include "client.h" extern u_char rxpkt[]; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/rvifmain.c --- a/rvinterf/lowlevel/rvifmain.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/rvifmain.c Tue Feb 04 05:03:57 2014 +0000 @@ -11,8 +11,8 @@ #include #include #include -#include "../pktmux.h" -#include "../localsock.h" +#include "../include/pktmux.h" +#include "../include/localsock.h" #include "client.h" extern int target_fd, listener; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/lowlevel/rvtdump.c --- a/rvinterf/lowlevel/rvtdump.c Mon Feb 03 06:35:29 2014 +0000 +++ b/rvinterf/lowlevel/rvtdump.c Tue Feb 04 05:03:57 2014 +0000 @@ -9,7 +9,7 @@ #include #include #include -#include "../pktmux.h" +#include "../include/pktmux.h" extern int target_fd; extern char *baudrate_name; diff -r c33fb341faeb -r 2f285f20d617 rvinterf/pktmux.h --- a/rvinterf/pktmux.h Mon Feb 03 06:35:29 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -/* - * Definitions for the RVT MUX over-the-wire protocol - */ - -#define STX 0x02 -#define DLE 0x10 - -#define RVT_RV_HEADER 0x11 -#define RVT_L1_HEADER 0x12 -#define RVT_L23_HEADER 0x13 -#define RVT_TM_HEADER 0x14 -#define RVT_RNET_HEADER 0x15 -#define RVT_PROF_HEADER 0x16 -#define RVT_GTTBACK_HEADER 0x17 -#define RVT_OTHER_HEADER 0x18 -#define RVT_INVALID_HEADER 0xFF