Skip to content

Commit

Permalink
Contiki configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
obgm committed Apr 12, 2012
1 parent 52faf37 commit a8b92f7
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 32 deletions.
4 changes: 3 additions & 1 deletion Makefile → Makefile.contiki
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVe

CFLAGS += -DUIP_CONF_TCP=0

APPS += dtls/aes dtls/sha2 dtls/sha1 dtls/md5 dtls
APPS += tinydtls/aes tinydtls/sha2 tinydtls

ccm-test: tests/ccm-test

include $(CONTIKI)/Makefile.include
14 changes: 0 additions & 14 deletions Makefile.dtls

This file was deleted.

100 changes: 100 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Makefile for tinydtls
#
# Copyright (C) 2011--2012 Olaf Bergmann <[email protected]>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# the library's version
VERSION:=@PACKAGE_VERSION@

# tools
@SET_MAKE@
SHELL = /bin/sh
MKDIR = mkdir
ETAGS = @ETAGS@

abs_builddir = @abs_builddir@
top_builddir = @top_builddir@
package = @PACKAGE_TARNAME@-@PACKAGE_VERSION@

# files and flags
SOURCES:= dsrv.c peer.c netq.c dtls.c crypto.c ccm.c hmac.c debug.c
OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) aes/rijndael.o @OPT_OBJS@
HEADERS:=dsrv.h dtls.h hmac.h peer.h netq.h debug.h config.h uthash.h numeric.h crypto.h global.h ccm.h
CFLAGS:=-Wall -pedantic -std=c99 @CFLAGS@
CPPFLAGS:=@CPPFLAGS@ -DDTLS_CHECK_CONTENTTYPE
SUBDIRS:=tests doc md5 sha1 sha2 aes
DISTDIR=$(top_builddir)/$(package)
FILES:=Makefile.in configure configure.in config.h.in $(SOURCES) $(HEADERS)
LIB:=libtinydtls.a
LDFLAGS:=@LIBS@
ARFLAGS:=cru
doc:=doc

.PHONY: all dirs clean distclean .gitignore doc TAGS

.SUFFIXES:
.SUFFIXES: .c .o

all: $(LIB) dirs

check:
echo DISTDIR: $(DISTDIR)
echo top_builddir: $(top_builddir)
$(MAKE) -C tests check

dirs: $(SUBDIRS)
for dir in $^; do \
$(MAKE) -C $$dir ; \
done

$(LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
ranlib $@

clean:
@rm -f $(PROGRAM) main.o $(LIB) $(OBJECTS)
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean ; \
done

doc:
$(MAKE) -C doc

distclean: clean
@rm -rf $(DISTDIR)
@rm -f *~ $(DISTDIR).tar.gz

dist: $(FILES) $(SUBDIRS)
test -d $(DISTDIR) || mkdir $(DISTDIR)
cp $(FILES) $(DISTDIR)
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir dist; \
done
tar czf $(package).tar.gz $(DISTDIR)

TAGS:
$(ETAGS) -o $@.new $(SOURCES)
$(ETAGS) -a -o $@.new $(HEADERS)
mv $@.new $@

.gitignore:
echo "core\n*~\n*.[oa]\n*.gz\n*.cap\n$(PROGRAM)\n$(DISTDIR)\n.gitignore" >$@
17 changes: 17 additions & 0 deletions Makefile.tinydtls
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This is a -*- Makefile -*-

ifeq ($(TARGET), redbee-econotag)
CFLAGS += -DSHA2_USE_INTTYPES_H=1 -DLITTLE_ENDIAN=3412 -DBYTE_ORDER=LITTLE_ENDIAN
endif

ifeq ($(TARGET), native)
CFLAGS += -DSHA2_USE_INTTYPES_H=1
endif

ifeq ($(TARGET), minimal-net)
CFLAGS += -DSHA2_USE_INTTYPES_H=1
endif

CFLAGS += -DDTLSv12 -DWITH_SHA256

tinydtls_src = dtls.c crypto.c hmac.c debug.c rijndael.c sha2.c ccm.c
17 changes: 0 additions & 17 deletions config.h

This file was deleted.

55 changes: 55 additions & 0 deletions config.h.contiki
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_

#include "contiki.h"
#include "contiki-lib.h"
#include "contiki-net.h"

#define WITH_CONTIKI 1

#define DEBUG DEBUG_PRINT
#define HAVE_STRNLEN 1
#define HAVE_SNPRINTF 1

#ifndef DTLS_CIPHER_CONTEXT_MAX
/** The maximum number of cipher contexts that can be used in parallel. */
# define DTLS_CIPHER_CONTEXT_MAX 4
#endif

#ifndef DTLS_HASH_MAX
/** The maximum number of hash functions that can be used in parallel. */
# define DTLS_HASH_MAX 2
#endif

#ifndef DTLS_PEER_MAX
/** The maximum number DTLS peers (i.e. sessions). */
# define DTLS_PEER_MAX 4
#endif

#include "contiki-conf.h"

#if defined(PLATFORM) && PLATFORM == PLATFORM_MC1322X
/* Redbee econotags get a special treatment here: endianness is set
* explicitly, and assert() is defined as emtpy directive unless
* HAVE_ASSERT_H is given.
*/
#define HAVE_ASSERT_H

/* #define BYTE_ORDER UIP_LITTLE_ENDIAN */

#ifndef HAVE_ASSERT_H
# define assert(x)
#endif

#endif /* defined(PLATFORM) && PLATFORM == PLATFORM_MC1322X */

#ifndef BYTE_ORDER
# ifdef UIP_CONF_BYTE_ORDER
# define BYTE_ORDER UIP_CONF_BYTE_ORDER
# else
# error "UIP_CONF_BYTE_ORDER not defined"
# endif /* UIP_CONF_BYTE_ORDER */
#endif /* BYTE_ORDER */

#endif /* _CONFIG_H_ */

125 changes: 125 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/* config.h.in. Generated from configure.in by autoheader. */

/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD

/* Define if you do not want intermix cleartext with DTLS */
#undef DSRV_NO_PROTOCOL_DEMUX

/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H

/* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET

/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H

/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT

/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET

/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP

/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H

/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the home page for this package. */
#undef PACKAGE_URL

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif

/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif

/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc

/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
Loading

0 comments on commit a8b92f7

Please sign in to comment.