diff options
author | intel-ethernet <eric_mann@mail.intel.com> | 2014-01-31 14:09:43 -0800 |
---|---|---|
committer | intel-ethernet <eric_mann@mail.intel.com> | 2014-01-31 14:09:43 -0800 |
commit | feb60bb2371733f203fcd9cab555084be3a83103 (patch) | |
tree | 406fe9bb6ec79e1a59ccfe43ea1801bd0e2d75b1 | |
parent | 8656efee75b35dd29f1d03c83b8bc8668e53185d (diff) | |
parent | a123960d37f705406cdebf51cfb31937484fa6cb (diff) | |
download | Open-AVB-feb60bb2371733f203fcd9cab555084be3a83103.tar.gz |
Merge pull request #43 from craiggunther/open-avb-next
Allow simple_listener to attach to a stream after simple_talker has been running for at least 1 second
-rw-r--r-- | examples/simple_listener/simple_listener.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/examples/simple_listener/simple_listener.c b/examples/simple_listener/simple_listener.c index 25abe042..0cc61acd 100644 --- a/examples/simple_listener/simple_listener.c +++ b/examples/simple_listener/simple_listener.c @@ -78,6 +78,10 @@ pcap_t* handle; u_char ETHER_TYPE[] = { 0x22, 0xf0 }; SNDFILE* snd_file; +#define VERSION_STR "1.1" +static const char *version_str = "simple_listener v" VERSION_STR "\n" + "Copyright (c) 2012, Intel Corporation\n"; + static void help() { fprintf(stderr, "\n" @@ -87,7 +91,7 @@ static void help() " -h show this message\n" " -i specify interface for AVB connection\n" " -f set the name of the output wav-file\n" - "\n" "%s" "\n"); + "\n" "%s" "\n", version_str); exit(1); } @@ -180,8 +184,9 @@ int msg_process(char *buf, int buflen) uint32_t id; fprintf(stderr, "Msg: %s\n", buf); int l = 0; - if ('S' == buf[l++] && 'N' == buf[l++] && 'E' == buf[l++] && 'T' == buf[++l]) + if (strncmp(buf, "SNE T:", 6) == 0 || strncmp(buf, "SJO T:", 6) == 0) { + l = 6; // skip "Sxx T:" while ('S' != buf[l++]); l++; for(int j = 0; j < 8 ; l+=2, j++) @@ -214,20 +219,6 @@ int recv_msg() } -int join_vlan() -{ - int rc; - char *msgbuf = malloc(1500); - if (NULL == msgbuf) - return -1; - memset(msgbuf, 0, 1500); - sprintf(msgbuf, "V++:I=0002"); - rc = send_msg(msgbuf, 1500); - - free(msgbuf); - return rc; -} - int await_talker() { while (0 == talker) @@ -249,6 +240,20 @@ int send_msg(char *data, int data_len) return 0; } +int join_vlan() +{ + int rc; + char *msgbuf = malloc(1500); + if (NULL == msgbuf) + return -1; + memset(msgbuf, 0, 1500); + sprintf(msgbuf, "V++:I=0002"); + rc = send_msg(msgbuf, 1500); + + free(msgbuf); + return rc; +} + int mrp_disconnect() { int rc; |