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-2024 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.4.0
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_SYN_QUEUE_SIZE
39  #warning TCP_SYN_QUEUE_SIZE property is deprecated. TCP_DEFAULT_SYN_QUEUE_SIZE should be used instead.
40  #define TCP_DEFAULT_SYN_QUEUE_SIZE TCP_SYN_QUEUE_SIZE
41 #endif
42 
43 #ifdef MAC_FILTER_MAX_SIZE
44  //#warning MAC_FILTER_MAX_SIZE property is deprecated. MAC_ADDR_FILTER_SIZE should be used instead.
45  #define MAC_ADDR_FILTER_SIZE MAC_FILTER_MAX_SIZE
46 #endif
47 
48 #ifdef IPV4_FILTER_MAX_SIZE
49  //#warning IPV4_FILTER_MAX_SIZE property is deprecated. IPV4_MULTICAST_FILTER_SIZE should be used instead.
50  #define IPV4_MULTICAST_FILTER_SIZE IPV4_FILTER_MAX_SIZE
51 #endif
52 
53 #ifdef IPV6_FILTER_MAX_SIZE
54  //#warning IPV6_FILTER_MAX_SIZE property is deprecated. IPV6_MULTICAST_FILTER_SIZE should be used instead.
55  #define IPV6_MULTICAST_FILTER_SIZE IPV6_FILTER_MAX_SIZE
56 #endif
57 
58 #ifdef IPV4_MAX_DNS_SERVERS
59  //#warning IPV4_MAX_DNS_SERVERS property is deprecated. IPV4_DNS_SERVER_LIST_SIZE should be used instead.
60  #define IPV4_DNS_SERVER_LIST_SIZE IPV4_MAX_DNS_SERVERS
61 #endif
62 
63 #ifdef IPV6_MAX_DNS_SERVERS
64  //#warning IPV6_MAX_DNS_SERVERS property is deprecated. IPV6_DNS_SERVER_LIST_SIZE should be used instead.
65  #define IPV6_DNS_SERVER_LIST_SIZE IPV6_MAX_DNS_SERVERS
66 #endif
67 
68 #ifdef NET_TICK_STACK_SIZE
69  #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
70 #endif
71 
72 #ifdef NET_TICK_PRIORITY
73  #warning NET_TICK_PRIORITY property is deprecated and should be removed from net_config.h. TCP/IP stack now uses a single task.
74 #endif
75 
76 #ifdef NET_RX_STACK_SIZE
77  #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.
78  #define NET_TASK_STACK_SIZE NET_RX_STACK_SIZE
79 #endif
80 
81 #ifdef NET_RX_PRIORITY
82  #warning NET_RX_PRIORITY property is deprecated since the TCP/IP stack now uses a single task. NET_TASK_PRIORITY should be used instead.
83  #define NET_TASK_PRIORITY NET_RX_PRIORITY
84 #endif
85 
86 #endif
87 
88 //Legacy definitions
89 #define SOCKET_TYPE_RAW SOCKET_TYPE_RAW_IP
90 #define SOCKET_PROTOCOL_ICMP SOCKET_IP_PROTO_ICMP
91 #define SOCKET_PROTOCOL_IGMP SOCKET_IP_PROTO_IGMP
92 #define SOCKET_PROTOCOL_TCP SOCKET_IP_PROTO_TCP
93 #define SOCKET_PROTOCOL_UDP SOCKET_IP_PROTO_UDP
94 #define SOCKET_PROTOCOL_ICMPV6 SOCKET_IP_PROTO_ICMPV6
95 
96 #ifdef SMTP_DEFAULT_TIMEOUT
97  #define SMTP_CLIENT_DEFAULT_TIMEOUT SMTP_DEFAULT_TIMEOUT
98 #endif
99 
100 #ifdef SMTP_MAX_LINE_LENGTH
101  #define SMTP_CLIENT_MAX_LINE_LENGTH SMTP_MAX_LINE_LENGTH
102 #endif
103 
104 #ifdef SMTP_TLS_SUPPORT
105  #define SMTP_CLIENT_TLS_SUPPORT SMTP_TLS_SUPPORT
106 #endif
107 
108 #ifdef SMTP_LOGIN_AUTH_SUPPORT
109  #define SMTP_CLIENT_LOGIN_AUTH_SUPPORT SMTP_LOGIN_AUTH_SUPPORT
110 #endif
111 
112 #ifdef SMTP_PLAIN_AUTH_SUPPORT
113  #define SMTP_CLIENT_PLAIN_AUTH_SUPPORT SMTP_PLAIN_AUTH_SUPPORT
114 #endif
115 
116 #ifdef SMTP_CRAM_MD5_AUTH_SUPPORT
117  #define SMTP_CLIENT_CRAM_MD5_AUTH_SUPPORT SMTP_CRAM_MD5_AUTH_SUPPORT
118 #endif
119 
120 #define DhcpClientCtx DhcpClientContext
121 #define Dhcpv6ClientCtx Dhcpv6ClientContext
122 
123 #ifdef SNMP_AGENT_MAX_MIB_COUNT
124  #define SNMP_AGENT_MAX_MIBS SNMP_AGENT_MAX_MIB_COUNT
125 #endif
126 
127 #ifdef SNMP_AGENT_MAX_USER_COUNT
128  #define SNMP_AGENT_MAX_USERS SNMP_AGENT_MAX_USER_COUNT
129 #endif
130 
131 #ifdef MAC_MULTICAST_FILTER_SIZE
132  #define MAC_ADDR_FILTER_SIZE MAC_MULTICAST_FILTER_SIZE
133 #endif
134 
135 #define ftpRegisterTlsInitCallback ftpClientRegisterTlsInitCallback
136 #define ftpLogin ftpClientLoginEx
137 #define ftpGetWorkingDir ftpClientGetWorkingDir
138 #define ftpChangeWorkingDir ftpClientChangeWorkingDir
139 #define ftpChangeToParentDir ftpClientChangeToParentDir
140 #define ftpOpenDir ftpClientOpenDir
141 #define ftpReadDir ftpClientReadDir
142 #define ftpCloseDir ftpClientCloseDir
143 #define ftpMakeDir ftpClientCreateDir
144 #define ftpRemoveDir ftpClientDeleteDir
145 #define ftpOpenFile ftpClientOpenFile
146 #define ftpWriteFile(context, data, length, flags) ftpClientWriteFile(context, data, length, NULL, flags)
147 #define ftpReadFile ftpClientReadFile
148 #define ftpCloseFile ftpClientCloseFile
149 #define ftpRenameFile ftpClientRenameFile
150 #define ftpDeleteFile ftpClientDeleteFile
151 #define ftpClose ftpClientDeinit
152 
153 #define FTP_NO_SECURITY FTP_MODE_PLAINTEXT
154 #define FTP_IMPLICIT_SECURITY FTP_MODE_IMPLICIT_TLS
155 #define FTP_EXPLICIT_SECURITY FTP_MODE_EXPLICIT_TLS
156 #define FTP_ACTIVE_MODE FTP_MODE_ACTIVE
157 #define FTP_PASSIVE_MODE FTP_MODE_PASSIVE
158 
159 #define FTP_FOR_READING FTP_FILE_MODE_READ
160 #define FTP_FOR_WRITING FTP_FILE_MODE_WRITE
161 #define FTP_FOR_APPENDING FTP_FILE_MODE_APPEND
162 #define FTP_BINARY_TYPE FTP_FILE_MODE_BINARY
163 #define FTP_TEXT_TYPE FTP_FILE_MODE_TEXT
164 
165 #ifdef FTP_CLIENT_SOCKET_MIN_TX_BUFFER_SIZE
166  #define FTP_CLIENT_MIN_TCP_BUFFER_SIZE FTP_CLIENT_SOCKET_MIN_TX_BUFFER_SIZE
167 #endif
168 
169 #ifdef FTP_CLIENT_SOCKET_MAX_TX_BUFFER_SIZE
170  #define FTP_CLIENT_MAX_TCP_BUFFER_SIZE FTP_CLIENT_SOCKET_MAX_TX_BUFFER_SIZE
171 #endif
172 
173 #ifdef FTP_SERVER_CTRL_SOCKET_BUFFER_SIZE
174  #define FTP_SERVER_MIN_TCP_BUFFER_SIZE FTP_SERVER_CTRL_SOCKET_BUFFER_SIZE
175 #endif
176 
177 #ifdef FTP_SERVER_DATA_SOCKET_BUFFER_SIZE
178  #define FTP_SERVER_MAX_TCP_BUFFER_SIZE FTP_SERVER_DATA_SOCKET_BUFFER_SIZE
179 #endif
180 
181 #define NET_VERSION_STRING CYCLONE_TCP_VERSION_STRING
182 #define NET_MAJOR_VERSION CYCLONE_TCP_MAJOR_VERSION
183 #define NET_MINOR_VERSION CYCLONE_TCP_MINOR_VERSION
184 #define NET_REV_NUMBER CYCLONE_TCP_REV_NUMBER
185 
186 #define ftpClientMakeDir ftpClientCreateDir
187 #define ftpClientRemoveDir ftpClientDeleteDir
188 
189 #define MQTT_PROTOCOL_LEVEL_3_1 MQTT_VERSION_3_1
190 #define MQTT_PROTOCOL_LEVEL_3_1_1 MQTT_VERSION_3_1_1
191 #define mqttClientSetProtocolLevel mqttClientSetVersion
192 
193 #define socketBindToInterface socketSetInterface
194 
195 #define netMutex (netContext.mutex)
196 #define netEvent (netContext.event)
197 #define netTaskRunning (netContext.running)
198 #define netTimestamp (netContext.timestamp)
199 #define netInterface (netContext.interfaces)
200 
201 #ifdef IGMP_SUPPORT
202  #define IGMP_HOST_SUPPORT IGMP_SUPPORT
203 #endif
204 
205 #ifdef COAP_SERVER_STACK_SIZE
206  #define COAP_SERVER_TASK_STACK_SIZE COAP_SERVER_STACK_SIZE
207 #endif
208 
209 #ifdef COAP_SERVER_PRIORITY
210  #define COAP_SERVER_TASK_PRIORITY COAP_SERVER_PRIORITY
211 #endif
212 
213 #ifdef DHCPV6_RELAY_STACK_SIZE
214  #define DHCPV6_RELAY_TASK_STACK_SIZE DHCPV6_RELAY_STACK_SIZE
215 #endif
216 
217 #ifdef DHCPV6_RELAY_PRIORITY
218  #define DHCPV6_RELAY_TASK_PRIORITY DHCPV6_RELAY_PRIORITY
219 #endif
220 
221 #ifdef FTP_SERVER_STACK_SIZE
222  #define FTP_SERVER_TASK_STACK_SIZE FTP_SERVER_STACK_SIZE
223 #endif
224 
225 #ifdef FTP_SERVER_PRIORITY
226  #define FTP_SERVER_TASK_PRIORITY FTP_SERVER_PRIORITY
227 #endif
228 
229 #ifdef HTTP_SERVER_STACK_SIZE
230  #define HTTP_SERVER_TASK_STACK_SIZE HTTP_SERVER_STACK_SIZE
231 #endif
232 
233 #ifdef HTTP_SERVER_PRIORITY
234  #define HTTP_SERVER_TASK_PRIORITY HTTP_SERVER_PRIORITY
235 #endif
236 
237 #ifdef ICECAST_CLIENT_STACK_SIZE
238  #define ICECAST_CLIENT_TASK_STACK_SIZE ICECAST_CLIENT_STACK_SIZE
239 #endif
240 
241 #ifdef ICECAST_CLIENT_PRIORITY
242  #define ICECAST_CLIENT_TASK_PRIORITY ICECAST_CLIENT_PRIORITY
243 #endif
244 
245 #ifdef MODBUS_SERVER_STACK_SIZE
246  #define MODBUS_SERVER_TASK_STACK_SIZE MODBUS_SERVER_STACK_SIZE
247 #endif
248 
249 #ifdef MODBUS_SERVER_PRIORITY
250  #define MODBUS_SERVER_TASK_PRIORITY MODBUS_SERVER_PRIORITY
251 #endif
252 
253 #ifdef SNMP_AGENT_STACK_SIZE
254  #define SNMP_AGENT_TASK_STACK_SIZE SNMP_AGENT_STACK_SIZE
255 #endif
256 
257 #ifdef SNMP_AGENT_PRIORITY
258  #define SNMP_AGENT_TASK_PRIORITY SNMP_AGENT_PRIORITY
259 #endif
260 
261 #ifdef TFTP_SERVER_STACK_SIZE
262  #define TFTP_SERVER_TASK_STACK_SIZE TFTP_SERVER_STACK_SIZE
263 #endif
264 
265 #ifdef TFTP_SERVER_PRIORITY
266  #define TFTP_SERVER_TASK_PRIORITY TFTP_SERVER_PRIORITY
267 #endif
268 
269 #define icmpEnableEchoRequest icmpEnableEchoRequests
270 #define icmpEnableBroadcastEchoRequest icmpEnableBroadcastEchoRequests
271 #define icmpv6EnableEchoRequest icmpv6EnableEchoRequests
272 #define icmpv6EnableMulticastEchoRequest icmpv6EnableMulticastEchoRequests
273 
274 #endif