]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
compat: move all missing IPTOS defines to compat.h, fixes #4285
authorJaroslav Kysela <perex@perex.cz>
Fri, 17 Mar 2017 07:23:58 +0000 (08:23 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 17 Mar 2017 07:23:58 +0000 (08:23 +0100)
src/compat.h
src/config.c
src/tcp.c

index 45e93f67de33213f4aacef0149181d25d653467c..a58c34870e2a8e3c77aae664ac3b01528029ec1a 100644 (file)
 // 32-bit Android has only timegm64() and not timegm().
 // We replicate the behaviour of timegm() when the result overflows time_t.
 
+#endif /* ENABLE_ANDROID */
+
+#ifdef COMPAT_IPTOS
+
+#ifndef IPTOS_DSCP_MASK
 #define        IPTOS_DSCP_MASK         0xfc
+#endif
+#ifndef IPTOS_DSCP
 #define        IPTOS_DSCP(x)           ((x) & IPTOS_DSCP_MASK)
+#endif
+#ifndef IPTOS_DSCP_AF11
 #define        IPTOS_DSCP_AF11         0x28
 #define        IPTOS_DSCP_AF12         0x30
 #define        IPTOS_DSCP_AF13         0x38
 #define        IPTOS_DSCP_AF42         0x90
 #define        IPTOS_DSCP_AF43         0x98
 #define        IPTOS_DSCP_EF           0xb8
+#endif
 
+#ifndef IPTOS_CLASS_MASK
 #define        IPTOS_CLASS_MASK        0xe0
+#endif
+#ifndef IPTOS_CLASS
 #define        IPTOS_CLASS(class)      ((class) & IPTOS_CLASS_MASK)
+#endif
+#ifndef IPTOS_CLASS_CS0
 #define        IPTOS_CLASS_CS0         0x00
 #define        IPTOS_CLASS_CS1         0x20
 #define        IPTOS_CLASS_CS2         0x40
 #define        IPTOS_CLASS_CS5         0xa0
 #define        IPTOS_CLASS_CS6         0xc0
 #define        IPTOS_CLASS_CS7         0xe0
+#endif
 
 #define        IPTOS_CLASS_DEFAULT     IPTOS_CLASS_CS0
 
-#endif
+#endif /* COMPAT_IPTOS */
 
 #endif /* COMPAT_H */
index 9bf31bf0e0130b728766c9ba1dcb077cc990f12e..2b81fbb1cad56c043d76398251d178d963dc6141 100644 (file)
 #include "input/mpegts/scanfile.h"
 
 #include <netinet/ip.h>
-
-#ifndef IPTOS_CLASS_CS0
-#define IPTOS_CLASS_CS0                 0x00
-#define IPTOS_CLASS_CS1                 0x20
-#define IPTOS_CLASS_CS2                 0x40
-#define IPTOS_CLASS_CS3                 0x60
-#define IPTOS_CLASS_CS4                 0x80
-#define IPTOS_CLASS_CS5                 0xa0
-#define IPTOS_CLASS_CS6                 0xc0
-#define IPTOS_CLASS_CS7                 0xe0
-#endif
+#define COMPAT_IPTOS
+#include "compat.h"
 
 static void config_muxconfpath_notify ( void *o, const char *lang );
 
index 4b37aa648bf8984a30b19fc6c85af7d0c743fca7..f1cea9733c5dc75476bde6d6066c9ed6375123c3 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -41,6 +41,8 @@
 #include "notify.h"
 #include "access.h"
 #include "dvr/dvr.h"
+#define COMPAT_IPTOS
+#include "compat.h"
 
 #if ENABLE_LIBSYSTEMD_DAEMON
 #include <systemd/sd-daemon.h>
@@ -53,10 +55,6 @@ th_pipe_t tcp_server_pipe;
 /**
  *
  */
-#ifndef IPTOS_DSCP_MASK
-#define IPTOS_DSCP_MASK 0xfc
-#endif
-
 int
 socket_set_dscp(int sockfd, uint32_t dscp, char *errbuf, size_t errbufsize)
 {