summaryrefslogtreecommitdiffstats
path: root/code/jasmine/udp-common.h
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-04-06 23:21:42 -0400
committerZhijiang Hu <hu.zhijiang@zte.com.cn>2017-04-07 03:52:25 -0400
commit7c577e23dde00c759db0cca0898809c3d278b37a (patch)
tree7f8942a599a9b4dbf19f12c8179ded86834cdaa9 /code/jasmine/udp-common.h
parentd24bd81e5689c5d8531581fb8e3604d6851cc094 (diff)
jasmine(Just A Simple Multicast engINE) Initial mergev1.0.2
Change-Id: I7a543019c8d92314ef549bf72369b7276f39577d Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
Diffstat (limited to 'code/jasmine/udp-common.h')
-rwxr-xr-xcode/jasmine/udp-common.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/code/jasmine/udp-common.h b/code/jasmine/udp-common.h
new file mode 100755
index 00000000..861545b4
--- /dev/null
+++ b/code/jasmine/udp-common.h
@@ -0,0 +1,42 @@
+/*##############################################################################
+# Copyright (c) 2017 ZTE Coreporation and others.
+# hu.zhijiang@zte.com.cn
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################*/
+
+#ifndef _MCAST_UDP_COMMON_H
+#define _MCAST_UDP_COMMON_H
+
+#include <unistd.h>
+#include <netinet/ip.h>
+#include <netinet/udp.h>
+
+#define MCAST_DPORT DEF_PORT
+
+#define MCAST_TTL 8
+/*
+ * Force reuse
+ */
+#define MCAST_REUSE 1
+
+/*
+ * Loop to let server host itself can receive data too.
+ */
+#define MCAST_LOOP 1
+#define MCAST_ADDR_BASE "224.238.0."
+#define MCAST_ADDR_SUFFIX "31"
+
+// Initial data
+struct mc_info {
+ struct sockaddr_in group;
+};
+
+extern struct mc_info mcinfo;
+
+// How to capture udp packets: tcpdump -i ethx udp -vv -n
+
+int init_mcast_socket(struct in_addr *local_addr, struct sockaddr_in *maddr);
+#endif