aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2006-11-21 10:38:50 +0000
committerLev Walkin <vlm@lionet.info>2006-11-21 10:38:50 +0000
commit217f2403eb235a884d68f65c86acaf6ef9b2619a (patch)
tree1c06788a190d8883004af2e202fdc46c48445360
parent1fc091cc6a2bca61d6d5da0a5dccdb90dc561330 (diff)
ntohl
-rw-r--r--skeletons/asn_system.h9
-rw-r--r--skeletons/constr_SET.c8
2 files changed, 10 insertions, 7 deletions
diff --git a/skeletons/asn_system.h b/skeletons/asn_system.h
index 6dcca0eb..f920efc9 100644
--- a/skeletons/asn_system.h
+++ b/skeletons/asn_system.h
@@ -26,6 +26,12 @@
#define snprintf _snprintf
#define vsnprintf _vsnprintf
+/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */
+#define sys_ntohl(l) ((((l) << 24) & 0xff000000)
+ | (((l) << 16) & 0xff0000)
+ | (((l) << 8) & 0xff00)
+ | ((l) & 0xff))
+
#ifdef _MSC_VER /* MSVS.Net */
#ifndef __cplusplus
#define inline __inline
@@ -74,6 +80,9 @@ typedef unsigned int uint32_t;
#endif /* defined(sun) */
#endif
+#include <netinet/in.h> /* for ntohl() */
+#define sys_ntohl(foo) ntohl(foo)
+
#endif /* defined(__vxworks) */
#endif /* WIN32 */
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index 2c5d5d0b..ecf56617 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -6,12 +6,6 @@
#include <asn_internal.h>
#include <constr_SET.h>
-#ifndef WIN32
-#include <netinet/in.h> /* for ntohl() */
-#else
-#include <winsock2.h> /* for ntohl() */
-#endif
-
/* Check that all the mandatory members are present */
static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st);
@@ -411,7 +405,7 @@ _SET_is_populated(asn_TYPE_descriptor_t *td, void *st) {
midx = edx/(8 * sizeof(specs->_mandatory_elements[0]));
pres = ((unsigned int *)((char *)st+specs->pres_offset))[midx];
- must = ntohl(specs->_mandatory_elements[midx]);
+ must = sys_ntohl(specs->_mandatory_elements[midx]);
if((pres & must) == must) {
/*