lib/backtrace.h \
lib/bitmap.c \
lib/bitmap.h \
+ lib/byte-order.h \
lib/byteq.c \
lib/byteq.h \
lib/classifier.c \
lib/vconn.h \
lib/vlog-modules.def \
lib/vlog.c \
- lib/vlog.h \
- lib/xtoxll.h
+ lib/vlog.h
nodist_lib_libopenvswitch_a_SOURCES = \
lib/coverage-counters.c \
lib/dirs.c
--- /dev/null
+/*
+ * Copyright (c) 2008, 2010 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef BYTE_ORDER_H
+#define BYTE_ORDER_H 1
+
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <inttypes.h>
+
+static inline uint64_t
+htonll(uint64_t n)
+{
+ return htonl(1) == 1 ? n : ((uint64_t) htonl(n) << 32) | htonl(n >> 32);
+}
+
+static inline uint64_t
+ntohll(uint64_t n)
+{
+ return htonl(1) == 1 ? n : ((uint64_t) ntohl(n) << 32) | ntohl(n >> 32);
+}
+
+/* These macros may substitute for htons(), htonl(), and htonll() in contexts
+ * where function calls are not allowed, such as case labels. They should not
+ * be used elsewhere because all of them evaluate their argument many times. */
+#ifdef WORDS_BIGENDIAN
+#define CONSTANT_HTONS(VALUE) ((uint16_t) (VALUE))
+#define CONSTANT_HTONL(VALUE) ((uint32_t) (VALUE))
+#define CONSTANT_HTONLL(VALUE) ((uint64_t) (VALUE))
+#else
+#define CONSTANT_HTONS(VALUE) \
+ (((((uint16_t) (VALUE)) & 0xff00) >> 8) | \
+ ((((uint16_t) (VALUE)) & 0x00ff) << 8))
+#define CONSTANT_HTONL(VALUE) \
+ (((((uint32_t) (VALUE)) & 0x000000ff) << 24) | \
+ ((((uint32_t) (VALUE)) & 0x0000ff00) << 8) | \
+ ((((uint32_t) (VALUE)) & 0x00ff0000) >> 8) | \
+ ((((uint32_t) (VALUE)) & 0xff000000) >> 24))
+#define CONSTANT_HTONLL(VALUE) \
+ (((((uint64_t) (VALUE)) & UINT64_C(0x00000000000000ff)) << 56) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0x000000000000ff00)) << 40) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0x0000000000ff0000)) << 24) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0x00000000ff000000)) << 8) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0x000000ff00000000)) >> 8) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0x0000ff0000000000)) >> 24) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0x00ff000000000000)) >> 40) | \
+ ((((uint64_t) (VALUE)) & UINT64_C(0xff00000000000000)) >> 56))
+#endif
+
+#endif /* byte-order.h */
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
+#include "byte-order.h"
#include "coverage.h"
#include "dynamic-string.h"
#include "hash.h"
#include "packets.h"
#include "unaligned.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(flow)
#include <stdlib.h>
#include <time.h>
+#include "byte-order.h"
#include "flow.h"
#include "hmap.h"
#include "mac-learning.h"
#include "timeval.h"
#include "vconn.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(learning_switch)
#include <errno.h>
#include <stdlib.h>
+#include "byte-order.h"
#include "dynamic-string.h"
#include "netdev.h"
#include "ofp-util.h"
#include "socket-util.h"
#include "vconn.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(ofp_parse)
#include <stdlib.h>
#include <ctype.h>
+#include "byte-order.h"
#include "compiler.h"
#include "dynamic-string.h"
#include "flow.h"
#include "packets.h"
#include "pcap.h"
#include "util.h"
-#include "xtoxll.h"
static void ofp_print_port_name(struct ds *string, uint16_t port);
static void ofp_print_queue_name(struct ds *string, uint32_t port);
#include "ofp-print.h"
#include <inttypes.h>
#include <stdlib.h>
+#include "byte-order.h"
#include "ofp-util.h"
#include "ofpbuf.h"
#include "packets.h"
#include "random.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(ofp_util)
#define UNALIGNED_H 1
#include <stdint.h>
-#include "xtoxll.h"
+#include "byte-order.h"
/* Public API. */
static inline uint16_t get_unaligned_u16(const uint16_t *);
+++ /dev/null
-/*
- * Copyright (c) 2008, 2010 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef XTOXLL_H
-#define XTOXLL_H 1
-
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-static inline uint64_t
-htonll(uint64_t n)
-{
- return htonl(1) == 1 ? n : ((uint64_t) htonl(n) << 32) | htonl(n >> 32);
-}
-
-static inline uint64_t
-ntohll(uint64_t n)
-{
- return htonl(1) == 1 ? n : ((uint64_t) ntohl(n) << 32) | ntohl(n >> 32);
-}
-
-/* These macros may substitute for htons(), htonl(), and htonll() in contexts
- * where function calls are not allowed, such as case labels. They should not
- * be used elsewhere because all of them evaluate their argument many times. */
-#ifdef WORDS_BIGENDIAN
-#define CONSTANT_HTONS(VALUE) ((uint16_t) (VALUE))
-#define CONSTANT_HTONL(VALUE) ((uint32_t) (VALUE))
-#define CONSTANT_HTONLL(VALUE) ((uint64_t) (VALUE))
-#else
-#define CONSTANT_HTONS(VALUE) \
- (((((uint16_t) (VALUE)) & 0xff00) >> 8) | \
- ((((uint16_t) (VALUE)) & 0x00ff) << 8))
-#define CONSTANT_HTONL(VALUE) \
- (((((uint32_t) (VALUE)) & 0x000000ff) << 24) | \
- ((((uint32_t) (VALUE)) & 0x0000ff00) << 8) | \
- ((((uint32_t) (VALUE)) & 0x00ff0000) >> 8) | \
- ((((uint32_t) (VALUE)) & 0xff000000) >> 24))
-#define CONSTANT_HTONLL(VALUE) \
- (((((uint64_t) (VALUE)) & UINT64_C(0x00000000000000ff)) << 56) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0x000000000000ff00)) << 40) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0x0000000000ff0000)) << 24) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0x00000000ff000000)) << 8) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0x000000ff00000000)) >> 8) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0x0000ff0000000000)) >> 24) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0x00ff000000000000)) >> 40) | \
- ((((uint64_t) (VALUE)) & UINT64_C(0xff00000000000000)) >> 56))
-#endif
-
-#endif /* xtoxll.h */
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include "byte-order.h"
#include "collectors.h"
#include "flow.h"
#include "netflow.h"
#include "timeval.h"
#include "util.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(netflow)
#include <netinet/in.h>
#include <stdbool.h>
#include <stdlib.h>
+#include "byte-order.h"
#include "classifier.h"
#include "coverage.h"
#include "discovery.h"
#include "unixctl.h"
#include "vconn.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(ofproto)
tests/lcov/ovsdb-server \
tests/lcov/ovsdb-tool \
tests/lcov/test-aes128 \
+ tests/lcov/test-byte-order \
tests/lcov/test-classifier \
tests/lcov/test-csum \
tests/lcov/test-dhcp-client \
tests/lcov/test-timeval \
tests/lcov/test-type-props \
tests/lcov/test-uuid \
- tests/lcov/test-vconn \
- tests/lcov/test-xtoxll
+ tests/lcov/test-vconn
$(lcov_wrappers): tests/lcov-wrapper.in
@test -d tests/lcov || mkdir tests/lcov
tests/valgrind/ovsdb-server \
tests/valgrind/ovsdb-tool \
tests/valgrind/test-aes128 \
+ tests/valgrind/test-byte-order \
tests/valgrind/test-classifier \
tests/valgrind/test-csum \
tests/valgrind/test-dhcp-client \
tests/valgrind/test-timeval \
tests/valgrind/test-type-props \
tests/valgrind/test-uuid \
- tests/valgrind/test-vconn \
- tests/valgrind/test-xtoxll
+ tests/valgrind/test-vconn
$(valgrind_wrappers): tests/valgrind-wrapper.in
@test -d tests/valgrind || mkdir tests/valgrind
tests/testpki-req.pem \
tests/testpki-req2.pem
-noinst_PROGRAMS += tests/test-xtoxll
-tests_test_xtoxll_SOURCES = tests/test-xtoxll.c
-tests_test_xtoxll_LDADD = lib/libopenvswitch.a
+noinst_PROGRAMS += tests/test-byte-order
+tests_test_byte_order_SOURCES = tests/test-byte-order.c
+tests_test_byte_order_LDADD = lib/libopenvswitch.a
# Python tests.
EXTRA_DIST += \
AT_CLEANUP
AT_SETUP([test byte order conversion])
-AT_KEYWORDS([xtoxll])
-AT_CHECK([test-xtoxll], [0], [ignore])
+AT_KEYWORDS([byte order])
+AT_CHECK([test-byte-order], [0], [ignore])
AT_CLEANUP
--- /dev/null
+/*
+ * Copyright (c) 2010 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <config.h>
+#include "byte-order.h"
+#include <assert.h>
+#include <inttypes.h>
+
+int
+main(void)
+{
+ /* I picked some random numbers. */
+ const uint16_t s = 0xc9bd;
+ const uint32_t l = 0xffe56ae8;
+ const uint64_t ll = UINT64_C(0xb6fe878a9117ecdb);
+
+ assert(htons(ntohs(s)) == s);
+ assert(ntohs(htons(s)) == s);
+ assert(CONSTANT_HTONS(ntohs(s)) == s);
+ assert(ntohs(CONSTANT_HTONS(s)) == s);
+ assert(ntohs(CONSTANT_HTONS(l)) == (uint16_t) l);
+ assert(ntohs(CONSTANT_HTONS(ll)) == (uint16_t) ll);
+
+ assert(htonl(ntohl(l)) == l);
+ assert(ntohl(htonl(l)) == l);
+ assert(CONSTANT_HTONL(ntohl(l)) == l);
+ assert(ntohl(CONSTANT_HTONL(l)) == l);
+ assert(ntohl(CONSTANT_HTONL(ll)) == (uint32_t) ll);
+
+ assert(htonll(ntohll(ll)) == ll);
+ assert(ntohll(htonll(ll)) == ll);
+ assert(CONSTANT_HTONLL(ntohll(ll)) == ll);
+ assert(ntohll(CONSTANT_HTONLL(ll)));
+
+ return 0;
+}
#include "classifier.h"
#include <errno.h>
#include <limits.h>
+#include "byte-order.h"
#include "command-line.h"
#include "flow.h"
#include "packets.h"
-#include "xtoxll.h"
#undef NDEBUG
#include <assert.h>
+++ /dev/null
-/*
- * Copyright (c) 2010 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <config.h>
-#include "xtoxll.h"
-#include <assert.h>
-#include <inttypes.h>
-
-int
-main(void)
-{
- /* I picked some random numbers. */
- const uint16_t s = 0xc9bd;
- const uint32_t l = 0xffe56ae8;
- const uint64_t ll = UINT64_C(0xb6fe878a9117ecdb);
-
- assert(htons(ntohs(s)) == s);
- assert(ntohs(htons(s)) == s);
- assert(CONSTANT_HTONS(ntohs(s)) == s);
- assert(ntohs(CONSTANT_HTONS(s)) == s);
- assert(ntohs(CONSTANT_HTONS(l)) == (uint16_t) l);
- assert(ntohs(CONSTANT_HTONS(ll)) == (uint16_t) ll);
-
- assert(htonl(ntohl(l)) == l);
- assert(ntohl(htonl(l)) == l);
- assert(CONSTANT_HTONL(ntohl(l)) == l);
- assert(ntohl(CONSTANT_HTONL(l)) == l);
- assert(ntohl(CONSTANT_HTONL(ll)) == (uint32_t) ll);
-
- assert(htonll(ntohll(ll)) == ll);
- assert(ntohll(htonll(ll)) == ll);
- assert(CONSTANT_HTONLL(ntohll(ll)) == ll);
- assert(ntohll(CONSTANT_HTONLL(ll)));
-
- return 0;
-}
#include <sys/stat.h>
#include <sys/time.h>
+#include "byte-order.h"
#include "command-line.h"
#include "compiler.h"
#include "dirs.h"
#include "util.h"
#include "vconn.h"
#include "vlog.h"
-#include "xtoxll.h"
VLOG_DEFINE_THIS_MODULE(ofctl)
#include <config.h>
#include "bridge.h"
+#include "byte-order.h"
#include <assert.h>
#include <errno.h>
#include <arpa/inet.h>
#include "vswitchd/vswitch-idl.h"
#include "xenserver.h"
#include "vlog.h"
-#include "xtoxll.h"
#include "sflow_api.h"
VLOG_DEFINE_THIS_MODULE(bridge)