transport: Add CONFI_WS_TRANSPORT for optimize the code size

This commit is contained in:
liuhan
2021-04-16 17:23:18 +08:00
committed by yuanjm
parent 1d05bb7c01
commit 63e489255f
8 changed files with 71 additions and 10 deletions

View File

@@ -1,8 +1,15 @@
idf_component_register(SRCS "transport.c"
"transport_ssl.c"
"transport_tcp.c"
"transport_ws.c"
"transport_utils.c"
set(srcs
"transport.c"
"transport_ssl.c"
"transport_tcp.c"
"transport_utils.c")
if(CONFIG_WS_TRANSPORT)
list(APPEND srcs
"transport_ws.c")
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "private_include"
REQUIRES lwip esp-tls)

View File

@@ -1,9 +1,18 @@
menu "TCP Transport"
config WS_BUFFER_SIZE
int "Websocket transport buffer size"
default 1024
help
Size of the buffer used for constructing the HTTP Upgrade request during connect
menu "Websocket"
config WS_TRANSPORT
bool "Enable Websocket Transport"
default y
help
Enable support for creating websocket transport.
config WS_BUFFER_SIZE
int "Websocket transport buffer size"
default 1024
depends on WS_TRANSPORT
help
Size of the buffer used for constructing the HTTP Upgrade request during connect
endmenu
endmenu

View File

@@ -1,2 +1,6 @@
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_PRIV_INCLUDEDIRS := private_include
ifndef CONFIG_WS_TRANSPORT
COMPONENT_OBJEXCLUDE := transport_ws.o
endif

View File

@@ -1,3 +1,17 @@
// Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD
//
// 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 <string.h>
#include <ctype.h>
#include <stdlib.h>

View File

@@ -1,3 +1,17 @@
// Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD
//
// 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 <stdlib.h>
#include <string.h>
#include <ctype.h>