Skip to content

Commit

Permalink
Merge pull request #113 from heesub/sprint4-for-swc
Browse files Browse the repository at this point in the history
Sprint4 for swc
  • Loading branch information
sunghan-chang committed May 25, 2017
2 parents 478279f + e9808a4 commit 58bac9e
Show file tree
Hide file tree
Showing 190 changed files with 14,822 additions and 1,912 deletions.
1 change: 1 addition & 0 deletions apps/examples/dtls_client/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_DTLS_CLIENT
bool "DTLS client application"
default n
depends on NET_SECURITY_TLS

if EXAMPLES_DTLS_CLIENT

Expand Down
23 changes: 20 additions & 3 deletions apps/examples/dtls_client/dtls_client_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,30 @@
* Included Files
****************************************************************************/

#include <stdio.h>
#include <string.h>

#include "tls/config.h"

#include <stdio.h>
#if !defined(MBEDTLS_SSL_CLI_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) || \
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_TIMING_C) || \
!defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C) || \
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_RSA_C) || \
!defined(MBEDTLS_CERTS_C)
int dtls_client_main(int argc, char **argv)
{
printf("MBEDTLS_SSL_CLI_C and/or MBEDTLS_SSL_PROTO_DTLS and/or\n");
printf("MBEDTLS_NET_C and/or MBEDTLS_TIMING_C and/or\n");
printf("MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or\n");
printf("MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_RSA_C and/or\n");
printf("MBEDTLS_CERTS_C and/or MBEDTLS_PEM_PARSE_C not defined.\n");
return 0;
}
#else

#define mbedtls_printf printf
#define mbedtls_fprintf fprintf

#include <string.h>

#include "tls/net.h"
#include "tls/debug.h"
#include "tls/ssl.h"
Expand Down Expand Up @@ -410,3 +426,4 @@ int dtls_client_main(int argc, char **argv)

return 0;
}
#endif
1 change: 1 addition & 0 deletions apps/examples/dtls_server/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_DTLS_SERVER
bool "DTLS server application"
default n
depends on NET_SECURITY_TLS

if EXAMPLES_DTLS_SERVER

Expand Down
29 changes: 24 additions & 5 deletions apps/examples/dtls_server/dtls_server_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,33 @@
* Included Files
****************************************************************************/

#include "tls/config.h"

#include <stdio.h>
#define mbedtls_printf printf
#define mbedtls_fprintf fprintf

#include <string.h>
#include <stdlib.h>

#include "tls/config.h"

#if !defined(MBEDTLS_SSL_SRV_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) || \
!defined(MBEDTLS_SSL_COOKIE_C) || !defined(MBEDTLS_NET_C) || \
!defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C) || \
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_RSA_C) || \
!defined(MBEDTLS_CERTS_C) || !defined(MBEDTLS_PEM_PARSE_C) || \
!defined(MBEDTLS_TIMING_C)

int dtls_server_main(int argc, char **argv)
{
printf("MBEDTLS_SSL_SRV_C and/or MBEDTLS_SSL_PROTO_DTLS and/or\n");
printf("MBEDTLS_SSL_COOKIE_C and/or MBEDTLS_NET_C and/or\n");
printf("MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or\n");
printf("MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_RSA_C and/or\n");
printf("MBEDTLS_CERTS_C and/or MBEDTLS_PEM_PARSE_C and/or\n");
printf("MBEDTLS_TIMING_C not defined.\n");
return 0;
}
#else

#define mbedtls_printf printf
#define mbedtls_fprintf fprintf
#include "tls/entropy.h"
#include "tls/ctr_drbg.h"
#include "tls/certs.h"
Expand Down Expand Up @@ -439,3 +457,4 @@ int dtls_server_main(int argc, char **argv)

return 0;
}
#endif
6 changes: 6 additions & 0 deletions apps/examples/libtuv/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config EXAMPLES_LIBTUV
bool "libtuv Example"
select LIBTUV
default n
---help---
Enable the libtuv Example
21 changes: 21 additions & 0 deletions apps/examples/libtuv/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
###########################################################################
#
# Copyright 2017 Samsung Electronics All Rights Reserved.
#
# 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.
#
###########################################################################

ifeq ($(CONFIG_EXAMPLES_LIBTUV),y)
CONFIGURED_APPS += examples/libtuv
endif
163 changes: 163 additions & 0 deletions apps/examples/libtuv/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
############################################################################
#
# Copyright 2017 Samsung Electronics All Rights Reserved.
#
# 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.
#
############################################################################
############################################################################
# apps/examples/libtuv/Makefile
#
# Copyright (C) 2008, 2010-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################

-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs

# built-in application info

APPNAME = libtuv
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
THREADEXEC = TASH_EXECMD_SYNC

# Example

ASRCS =
CSRCS = libtuvapi.c
MAINSRC = libtuv_main.c

CFLAGS += -I$(TOPDIR)/../external/libtuv/include
CFLAGS += -I$(TOPDIR)/../external/libtuv/source/tinyara

AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))

SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)

ifneq ($(CONFIG_BUILD_KERNEL),y)
OBJS += $(MAINOBJ)
endif

ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif

ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif

CONFIG_EXAMPLES_LIBTUV_PROGNAME ?= libtuv$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_LIBTUV_PROGNAME)

ROOTDEPPATH = --dep-path .

# Common build

VPATH =

all: .built
.PHONY: clean depend distclean preconfig

$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)

$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)

.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built

ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)

install: $(BIN_DIR)$(DELIM)$(PROGNAME)

else
install:

endif

ifeq ($(CONFIG_EXAMPLES_LIBTUV),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(APPNAME)_main,$(THREADEXEC))

context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat

else
context:

endif

.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@

depend: .depend

clean:
$(call DELFILE, .built)
$(call CLEAN)

distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)

-include Make.dep

preconfig:

Loading

0 comments on commit 58bac9e

Please sign in to comment.