wolfssl_MDK_ARM.h
1 /* wolfssl_KEIL_RL.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 
23 /******************************************************************************/
25 /******************************************************************************/
26 #ifndef WOLFSSL_KEIL_RL_H
27 #define WOLFSSL_KEIL_RL_H
28 
29 
30 
31 #include <stdio.h>
32 
33 /* Go to STDIN */
34 #define fgets(buff, sz, fd) wolfssl_fgets(buff, sz, fd)
35 extern char * wolfssl_fgets ( char * str, int num, FILE * f ) ;
36 
37 #define SOCKET_T int
38 
39 /*** #include <socket.h> ***/
40 #define NUMBITSPERBYTE 8
41 #define FD_SETSIZE 10
42 
43 typedef long fd_mask;
44 #define NFDBITS (sizeof(fd_mask) * NUMBITSPERBYTE) /* bits per mask */
45 
46 typedef struct fd_set {
47  fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS];
48 } fd_set;
49 
50 /*** #include <sys/types.h> ***/
51 struct timeval {
52  long tv_sec; /* seconds */
53  long tv_usec; /* microseconds */
54 };
55 
56 #if defined(WOLFSSL_KEIL_TCP_NET)
57 
58 #if defined(WOLFSSL_MDK5)
59 #define SCK_EWOULDBLOCK BSD_ERROR_WOULDBLOCK
60 #define SCK_ETIMEOUT BSD_ERROR_TIMEOUT
61 #include "rl_net.h"
62 #endif
63 
64 typedef int socklen_t ;
65 
66 /* for avoiding conflict with KEIL-TCPnet BSD socket */
67 /* Bodies are in wolfssl_KEIL_RL.c */
68 #define connect(a,b,c) wolfssl_connect(a, (struct sockaddr* )(b), c)
69 #define accept wolfssl_accept
70 #define recv wolfssl_recv
71 #define send wolfssl_send
72 #define sleep wolfssl_sleep
73 
74 /* for avoiding conflicting with KEIL-TCPnet TCP socket */
75 /* Bodies are in test.h */
76 #define tcp_connect wolfssl_tcp_connect
77 #define tcp_socket wolfssl_tcp_soket
78 #define tcp_listen wolfssl_tcp_listen
79 #define tcp_select wolfssl_tcp_select
80 
81 extern int wolfssl_connect(int sd, const struct sockaddr* sa, int sz) ;
82 extern int wolfssl_accept(int sd, struct sockaddr*addr, socklen_t *addrlen);
83 extern int wolfssl_recv(int sd, void *buf, size_t len, int flags);
84 extern int wolfssl_send(int sd, const void *buf, size_t len, int flags);
85 extern void wolfssl_sleep(int sec) ;
86 extern int wolfssl_tcp_select(int sd, int timeout) ;
87 
89 /* TCPnet BSD socket does not have following functions. */
90 extern char *inet_ntoa(struct in_addr in);
91 extern unsigned long inet_addr(const char *cp);
92 extern int setsockopt(int sockfd, int level, int optname,
93  const void *optval, socklen_t optlen);
94 extern int select(int nfds, fd_set *readfds, fd_set *writefds,
95  fd_set *exceptfds, const struct timeval *timeout);
96 
97 #endif /* WOLFSSL_KEIL_TCP_NET */
98 
99 #endif /* WOLFSSL_KEIL_RL_H */
Definition: wolfssl_MDK_ARM.h:46
Definition: wolfssl_MDK_ARM.h:51