net_legacy.h
Go to the documentation of this file.
1/**
2 * @file net_legacy.h
3 * @brief Legacy definitions
4 *
5 * @section License
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 *
9 * Copyright (C) 2010-2021 Oryx Embedded SARL. All rights reserved.
10 *
11 * This file is part of CycloneTCP Open.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 *
27 * @author Oryx Embedded SARL (www.oryx-embedded.com)
28 * @version 2.1.2
29 **/
30
31#ifndef _NET_LEGACY_H
32#define _NET_LEGACY_H
33
34//Check compiler
35#if !defined(_WIN32)
36
37//Deprecated properties
38#ifdef TCP_IP_MAX_IF_NAME_LEN
39 #warning TCP_IP_MAX_IF_NAME_LEN property is deprecated. NET_MAX_IF_NAME_LEN should be used instead.
40 #define NET_MAX_IF_NAME_LEN TCP_IP_MAX_IF_NAME_LEN
41#endif
42
43#ifdef TCP_IP_MAX_HOSTNAME_LEN
44 #warning TCP_IP_MAX_HOSTNAME_LEN property is deprecated. NET_MAX_HOSTNAME_LEN should be used instead.
45 #define NET_MAX_HOSTNAME_LEN TCP_IP_MAX_HOSTNAME_LEN
46#endif
47
48#ifdef TCP_IP_MAX_PROXY_NAME_LEN
49 #warning TCP_IP_MAX_PROXY_NAME_LEN property is deprecated. NET_MAX_PROXY_NAME_LEN should be used instead.
50 #define NET_MAX_PROXY_NAME_LEN TCP_IP_MAX_PROXY_NAME_LEN
51#endif
52
53#ifdef TCP_IP_STATIC_OS_RESOURCES
54 #warning TCP_IP_STATIC_OS_RESOURCES property is deprecated. NET_STATIC_OS_RESOURCES should be used instead.
55 #define NET_STATIC_OS_RESOURCES TCP_IP_STATIC_OS_RESOURCES
56#endif
57
58#ifdef TCP_IP_TICK_STACK_SIZE
59 #warning TCP_IP_TICK_STACK_SIZE property is deprecated. NET_TICK_STACK_SIZE should be used instead.
60 #define NET_TICK_STACK_SIZE TCP_IP_TICK_STACK_SIZE
61#endif
62
63#ifdef TCP_IP_TICK_PRIORITY
64 #warning TCP_IP_TICK_PRIORITY property is deprecated. NET_TICK_PRIORITY should be used instead.
65 #define NET_TICK_PRIORITY TCP_IP_TICK_PRIORITY
66#endif
67
68#ifdef TCP_IP_TICK_INTERVAL
69 #warning TCP_IP_TICK_INTERVAL property is deprecated. NET_TICK_INTERVAL should be used instead.
70 #define NET_TICK_INTERVAL TCP_IP_TICK_INTERVAL
71#endif
72
73#ifdef TCP_IP_RX_STACK_SIZE
74 #warning TCP_IP_RX_STACK_SIZE property is deprecated. NET_RX_STACK_SIZE should be used instead.
75 #define NET_RX_STACK_SIZE TCP_IP_RX_STACK_SIZE
76#endif
77
78#ifdef TCP_IP_RX_PRIORITY
79 #warning TCP_IP_RX_PRIORITY property is deprecated. NET_RX_PRIORITY should be used instead.
80 #define NET_RX_PRIORITY TCP_IP_RX_PRIORITY
81#endif
82
83#ifdef TCP_SYN_QUEUE_SIZE
84 #warning TCP_SYN_QUEUE_SIZE property is deprecated. TCP_DEFAULT_SYN_QUEUE_SIZE should be used instead.
85 #define TCP_DEFAULT_SYN_QUEUE_SIZE TCP_SYN_QUEUE_SIZE
86#endif
87
88#ifdef MAC_FILTER_MAX_SIZE
89 //#warning MAC_FILTER_MAX_SIZE property is deprecated. MAC_ADDR_FILTER_SIZE should be used instead.
90 #define MAC_ADDR_FILTER_SIZE MAC_FILTER_MAX_SIZE
91#endif
92
93#ifdef IPV4_FILTER_MAX_SIZE
94 //#warning IPV4_FILTER_MAX_SIZE property is deprecated. IPV4_MULTICAST_FILTER_SIZE should be used instead.
95 #define IPV4_MULTICAST_FILTER_SIZE IPV4_FILTER_MAX_SIZE
96#endif
97
98#ifdef IPV6_FILTER_MAX_SIZE
99 //#warning IPV6_FILTER_MAX_SIZE property is deprecated. IPV6_MULTICAST_FILTER_SIZE should be used instead.
100 #define IPV6_MULTICAST_FILTER_SIZE IPV6_FILTER_MAX_SIZE
101#endif
102
103#ifdef IPV4_MAX_DNS_SERVERS
104 //#warning IPV4_MAX_DNS_SERVERS property is deprecated. IPV4_DNS_SERVER_LIST_SIZE should be used instead.
105 #define IPV4_DNS_SERVER_LIST_SIZE IPV4_MAX_DNS_SERVERS
106#endif
107
108#ifdef IPV6_MAX_DNS_SERVERS
109 //#warning IPV6_MAX_DNS_SERVERS property is deprecated. IPV6_DNS_SERVER_LIST_SIZE should be used instead.
110 #define IPV6_DNS_SERVER_LIST_SIZE IPV6_MAX_DNS_SERVERS
111#endif
112
113#ifdef NET_TICK_STACK_SIZE
114 #warning NET_TICK_STACK_SIZE property is deprecated and should be removed from net_config.h. The TCP/IP stack now uses a single task
115#endif
116
117#ifdef NET_TICK_PRIORITY
118 #warning NET_TICK_PRIORITY property is deprecated and should be removed from net_config.h. TCP/IP stack now uses a single task.
119#endif
120
121#ifdef NET_RX_STACK_SIZE
122 #warning NET_RX_STACK_SIZE property is deprecated since the TCP/IP stack now uses a single task. NET_TASK_STACK_SIZE should be used instead.
123 #define NET_TASK_STACK_SIZE NET_RX_STACK_SIZE
124#endif
125
126#ifdef NET_RX_PRIORITY
127 #warning NET_RX_PRIORITY property is deprecated since the TCP/IP stack now uses a single task. NET_TASK_PRIORITY should be used instead.
128 #define NET_TASK_PRIORITY NET_RX_PRIORITY
129#endif
130
131#endif
132
133//Legacy definitions
134#define SOCKET_TYPE_RAW SOCKET_TYPE_RAW_IP
135#define SOCKET_PROTOCOL_ICMP SOCKET_IP_PROTO_ICMP
136#define SOCKET_PROTOCOL_IGMP SOCKET_IP_PROTO_IGMP
137#define SOCKET_PROTOCOL_TCP SOCKET_IP_PROTO_TCP
138#define SOCKET_PROTOCOL_UDP SOCKET_IP_PROTO_UDP
139#define SOCKET_PROTOCOL_ICMPV6 SOCKET_IP_PROTO_ICMPV6
140
141//Deprecated functions
142#define tcpIpStackInit netInit
143#define tcpIpStackSetInterfaceName netSetInterfaceName
144#define tcpIpStackSetHostname netSetHostname
145#define tcpIpStackSetDriver netSetDriver
146#define tcpIpStackSetPhyDriver netSetPhyDriver
147#define tcpIpStackSetSpiDriver netSetSpiDriver
148#define tcpIpStackSetUartDriver netSetUartDriver
149#define tcpIpStackSetExtIntDriver netSetExtIntDriver
150#define tcpIpStackSetMacAddr netSetMacAddr
151#define tcpIpStackGetLinkState netGetLinkState
152#define tcpIpStackConfigInterface netConfigInterface
153#define tcpIpStackTickTask netTickTask
154#define tcpIpStackRxTask netRxTask
155#define tcpIpStackGetDefaultInterface netGetDefaultInterface
156#define tcpIpStackInitRand netInitRand
157#define tcpIpStackGetRand netGetRand
158#define tcpIpStackGetRandRange netGetRandRange
159#define tcpIpStackAttachLinkChangeCallback netAttachLinkChangeCallback
160#define tcpIpStackDetachLinkChangeCallback netDetachLinkChangeCallback
161#define tcpIpStackInvokeLinkChangeCallback netInvokeLinkChangeCallback
162
163#define ChunkedBuffer NetBuffer
164#define chunkedBufferGetLength netBufferGetLength
165#define chunkedBufferRead netBufferRead
166
167#ifdef SMTP_DEFAULT_TIMEOUT
168 #define SMTP_CLIENT_DEFAULT_TIMEOUT SMTP_DEFAULT_TIMEOUT
169#endif
170
171#ifdef SMTP_MAX_LINE_LENGTH
172 #define SMTP_CLIENT_MAX_LINE_LENGTH SMTP_MAX_LINE_LENGTH
173#endif
174
175#ifdef SMTP_TLS_SUPPORT
176 #define SMTP_CLIENT_TLS_SUPPORT SMTP_TLS_SUPPORT
177#endif
178
179#ifdef SMTP_LOGIN_AUTH_SUPPORT
180 #define SMTP_CLIENT_LOGIN_AUTH_SUPPORT SMTP_LOGIN_AUTH_SUPPORT
181#endif
182
183#ifdef SMTP_PLAIN_AUTH_SUPPORT
184 #define SMTP_CLIENT_PLAIN_AUTH_SUPPORT SMTP_PLAIN_AUTH_SUPPORT
185#endif
186
187#ifdef SMTP_CRAM_MD5_AUTH_SUPPORT
188 #define SMTP_CLIENT_CRAM_MD5_AUTH_SUPPORT SMTP_CRAM_MD5_AUTH_SUPPORT
189#endif
190
191#define DhcpClientCtx DhcpClientContext
192#define Dhcpv6ClientCtx Dhcpv6ClientContext
193
194#ifdef SNMP_AGENT_MAX_MIB_COUNT
195 #define SNMP_AGENT_MAX_MIBS SNMP_AGENT_MAX_MIB_COUNT
196#endif
197
198#ifdef SNMP_AGENT_MAX_USER_COUNT
199 #define SNMP_AGENT_MAX_USERS SNMP_AGENT_MAX_USER_COUNT
200#endif
201
202#ifdef MAC_MULTICAST_FILTER_SIZE
203 #define MAC_ADDR_FILTER_SIZE MAC_MULTICAST_FILTER_SIZE
204#endif
205
206#define ftpRegisterTlsInitCallback ftpClientRegisterTlsInitCallback
207#define ftpLogin ftpClientLoginEx
208#define ftpGetWorkingDir ftpClientGetWorkingDir
209#define ftpChangeWorkingDir ftpClientChangeWorkingDir
210#define ftpChangeToParentDir ftpClientChangeToParentDir
211#define ftpOpenDir ftpClientOpenDir
212#define ftpReadDir ftpClientReadDir
213#define ftpCloseDir ftpClientCloseDir
214#define ftpMakeDir ftpClientCreateDir
215#define ftpRemoveDir ftpClientDeleteDir
216#define ftpOpenFile ftpClientOpenFile
217#define ftpWriteFile(context, data, length, flags) ftpClientWriteFile(context, data, length, NULL, flags)
218#define ftpReadFile ftpClientReadFile
219#define ftpCloseFile ftpClientCloseFile
220#define ftpRenameFile ftpClientRenameFile
221#define ftpDeleteFile ftpClientDeleteFile
222#define ftpClose ftpClientDeinit
223
224#define FTP_NO_SECURITY FTP_MODE_PLAINTEXT
225#define FTP_IMPLICIT_SECURITY FTP_MODE_IMPLICIT_TLS
226#define FTP_EXPLICIT_SECURITY FTP_MODE_EXPLICIT_TLS
227#define FTP_ACTIVE_MODE FTP_MODE_ACTIVE
228#define FTP_PASSIVE_MODE FTP_MODE_PASSIVE
229
230#define FTP_FOR_READING FTP_FILE_MODE_READ
231#define FTP_FOR_WRITING FTP_FILE_MODE_WRITE
232#define FTP_FOR_APPENDING FTP_FILE_MODE_APPEND
233#define FTP_BINARY_TYPE FTP_FILE_MODE_BINARY
234#define FTP_TEXT_TYPE FTP_FILE_MODE_TEXT
235
236#ifdef FTP_CLIENT_SOCKET_MIN_TX_BUFFER_SIZE
237 #define FTP_CLIENT_MIN_TCP_BUFFER_SIZE FTP_CLIENT_SOCKET_MIN_TX_BUFFER_SIZE
238#endif
239
240#ifdef FTP_CLIENT_SOCKET_MAX_TX_BUFFER_SIZE
241 #define FTP_CLIENT_MAX_TCP_BUFFER_SIZE FTP_CLIENT_SOCKET_MAX_TX_BUFFER_SIZE
242#endif
243
244#ifdef FTP_SERVER_CTRL_SOCKET_BUFFER_SIZE
245 #define FTP_SERVER_MIN_TCP_BUFFER_SIZE FTP_SERVER_CTRL_SOCKET_BUFFER_SIZE
246#endif
247
248#ifdef FTP_SERVER_DATA_SOCKET_BUFFER_SIZE
249 #define FTP_SERVER_MAX_TCP_BUFFER_SIZE FTP_SERVER_DATA_SOCKET_BUFFER_SIZE
250#endif
251
252#define NET_VERSION_STRING CYCLONE_TCP_VERSION_STRING
253#define NET_MAJOR_VERSION CYCLONE_TCP_MAJOR_VERSION
254#define NET_MINOR_VERSION CYCLONE_TCP_MINOR_VERSION
255#define NET_REV_NUMBER CYCLONE_TCP_REV_NUMBER
256
257#define ftpClientMakeDir ftpClientCreateDir
258#define ftpClientRemoveDir ftpClientDeleteDir
259
260#define MQTT_PROTOCOL_LEVEL_3_1 MQTT_VERSION_3_1
261#define MQTT_PROTOCOL_LEVEL_3_1_1 MQTT_VERSION_3_1_1
262#define mqttClientSetProtocolLevel mqttClientSetVersion
263
264#define socketBindToInterface socketSetInterface
265
266#define netMutex (netContext.mutex)
267#define netEvent (netContext.event)
268#define netTaskRunning (netContext.running)
269#define netTimestamp (netContext.timestamp)
270#define netInterface (netContext.interfaces)
271
272#ifdef IGMP_SUPPORT
273 #define IGMP_HOST_SUPPORT IGMP_SUPPORT
274#endif
275
276#endif