[331] | 1 | /*
|
---|
| 2 | * TOPPERS ECHONET Lite Communication Middleware
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2017 Cores Co., Ltd. Japan
|
---|
| 5 | *
|
---|
| 6 | * ä¸è¨èä½æ¨©è
|
---|
| 7 | ã¯ï¼ä»¥ä¸ã®(1)ï½(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
| 8 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
| 9 | * å¤ã»åé
|
---|
| 10 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 11 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 12 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 13 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 14 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 15 | * ç¨ã§ããå½¢ã§åé
|
---|
| 16 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 17 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 18 | * è
|
---|
| 19 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 20 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 21 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 22 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 23 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 24 | * ã¨ï¼
|
---|
| 25 | * (a) åé
|
---|
| 26 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 27 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 28 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 29 | * (b) åé
|
---|
| 30 | å¸ã®å½¢æ
|
---|
| 31 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 32 | * å ±åãããã¨ï¼
|
---|
| 33 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 34 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 35 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 36 | 責ãããã¨ï¼
|
---|
| 37 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
| 38 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 39 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
| 40 | * å
|
---|
| 41 | 責ãããã¨ï¼
|
---|
| 42 | *
|
---|
| 43 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 44 | ã
|
---|
| 45 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
| 46 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
| 47 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
| 48 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
| 49 | *
|
---|
| 50 | * @(#) $Id$
|
---|
| 51 | */
|
---|
| 52 | #ifndef SHELLIF_H
|
---|
| 53 | #define SHELLIF_H
|
---|
| 54 |
|
---|
| 55 | #ifdef _MSC_VER
|
---|
| 56 | #include <time.h>
|
---|
| 57 | #endif
|
---|
| 58 |
|
---|
| 59 | #define __NEED_off_t
|
---|
| 60 | #define __NEED_ssize_t
|
---|
| 61 | #define __NEED_size_t
|
---|
| 62 | #define __NEED_mode_t
|
---|
| 63 | #define __NEED_dev_t
|
---|
| 64 | #define __NEED_pid_t
|
---|
| 65 | #define __NEED_gid_t
|
---|
| 66 | #define __NEED_uid_t
|
---|
| 67 | #define __NEED_socklen_t
|
---|
| 68 | #define __NEED_nlink_t
|
---|
| 69 | #define __NEED_blksize_t
|
---|
| 70 | #define __NEED_blkcnt_t
|
---|
| 71 | #define __NEED_ino_t
|
---|
| 72 | #define __NEED_time_t
|
---|
| 73 | #define __NEED_suseconds_t
|
---|
| 74 | #define __NEED_struct_timeval
|
---|
| 75 | #define __NEED_struct_timespec
|
---|
| 76 | #define __NEED_struct_iovec
|
---|
| 77 | #define __NEED_clockid_t
|
---|
| 78 | #define __NEED_socklen_t
|
---|
| 79 | #define __NEED_sa_family_t
|
---|
| 80 | #define __NEED_sigset_t
|
---|
| 81 |
|
---|
| 82 | #include "../musl-1.1.18/include/bits/alltypes.h"
|
---|
| 83 |
|
---|
| 84 | typedef unsigned char cc_t;
|
---|
| 85 | typedef unsigned int speed_t;
|
---|
| 86 | typedef unsigned int tcflag_t;
|
---|
| 87 |
|
---|
| 88 | #define NCCS 32
|
---|
| 89 |
|
---|
| 90 | #include "../musl-1.1.18/include/bits/fcntl.h"
|
---|
| 91 | #include "../musl-1.1.18/include/bits/termios.h"
|
---|
| 92 | #include "../musl-1.1.18/include/bits/stat.h"
|
---|
| 93 | #include "../musl-1.1.18/include/sys/select.h"
|
---|
| 94 | #ifndef _MSC_VER
|
---|
| 95 | #include "../musl-1.1.18/include/time.h"
|
---|
| 96 | #endif
|
---|
| 97 | #include "../musl-1.1.18/include/signal.h"
|
---|
| 98 | #include "../musl-1.1.18/include/stdio.h"
|
---|
| 99 | #include "../musl-1.1.18/include/sys/utsname.h"
|
---|
| 100 | #include "../musl-1.1.18/include/dirent.h"
|
---|
| 101 | #include "../musl-1.1.18/include/bits/ioctl.h"
|
---|
| 102 | #include "../musl-1.1.18/include/fcntl.h"
|
---|
| 103 | #include "../musl-1.1.18/include/bits/errno.h"
|
---|
| 104 | #include "../musl-1.1.18/include/sys/socket.h"
|
---|
| 105 |
|
---|
| 106 | #include <stddef.h>
|
---|
| 107 | #include <stdarg.h>
|
---|
| 108 |
|
---|
| 109 | // time.h
|
---|
| 110 | #define CLOCK_REALTIME 0
|
---|
| 111 |
|
---|
| 112 | // dirent.h
|
---|
| 113 | typedef struct __dirstream DIR;
|
---|
| 114 |
|
---|
| 115 | int shell_getdents(int, struct dirent *, size_t);
|
---|
| 116 | // pool.h
|
---|
| 117 | typedef unsigned long nfds_t;
|
---|
| 118 |
|
---|
| 119 | struct pollfd {
|
---|
| 120 | int fd;
|
---|
| 121 | short events;
|
---|
| 122 | short revents;
|
---|
| 123 | };
|
---|
| 124 |
|
---|
| 125 | int shell_poll(struct pollfd *, nfds_t, int);
|
---|
| 126 |
|
---|
| 127 | #define POLLIN 0x001
|
---|
| 128 | #define POLLOUT 0x004
|
---|
| 129 | #define POLLERR 0x008
|
---|
| 130 |
|
---|
| 131 | // stropts.h
|
---|
| 132 | int shell_ioctl(int, int, void *);
|
---|
| 133 | // unistd.h
|
---|
| 134 | #define STDIN_FILENO 0
|
---|
| 135 | #define STDOUT_FILENO 1
|
---|
| 136 | #define STDERR_FILENO 2
|
---|
| 137 |
|
---|
| 138 | int shell_rmdir(const char *);
|
---|
| 139 | int shell_ftruncate(int, off_t);
|
---|
| 140 | int shell_chdir(const char *);
|
---|
| 141 | char *shell_getcwd(char *, size_t);
|
---|
| 142 | int shell_chroot(const char *);
|
---|
| 143 | int shell_close(int);
|
---|
| 144 | int shell_llseek(int, off_t, off_t *, int);
|
---|
| 145 | int shell_fsync(int);
|
---|
| 146 | ssize_t shell_read(int, void *, size_t);
|
---|
| 147 | int shell_readv(int fd, const struct iovec *iov, int iovcnt);
|
---|
| 148 | ssize_t shell_write(int, const void *, size_t);
|
---|
| 149 | int shell_writev(int fd, const struct iovec *iov, int iovcnt);
|
---|
| 150 | int shell_link(const char *, const char *);
|
---|
| 151 | int shell_unlink(const char *);
|
---|
| 152 | pid_t shell_getpid(void);
|
---|
| 153 | int shell_access(const char *path, int mode);
|
---|
| 154 | // signal.h
|
---|
| 155 | int shell_sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict old);
|
---|
| 156 | int shell_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old);
|
---|
| 157 | // socket.h
|
---|
| 158 | int shell_socket(int, int, int);
|
---|
| 159 | int shell_connect(int, const struct sockaddr *, socklen_t);
|
---|
| 160 | ssize_t shell_send(int, const void *, size_t, int);
|
---|
| 161 | ssize_t shell_sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
|
---|
| 162 | ssize_t shell_sendmsg(int, const struct msghdr *, int);
|
---|
| 163 | int shell_bind(int, const struct sockaddr *, socklen_t);
|
---|
| 164 | int shell_listen(int, int);
|
---|
| 165 | int shell_accept(int, struct sockaddr *__restrict, socklen_t *__restrict);
|
---|
| 166 | ssize_t shell_recv(int, void *, size_t, int);
|
---|
| 167 | ssize_t shell_recvfrom(int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
|
---|
| 168 | ssize_t shell_recvmsg(int, struct msghdr *, int);
|
---|
| 169 | int shell_getsockopt(int, int, int, void *__restrict, socklen_t *__restrict);
|
---|
| 170 | int shell_setsockopt(int, int, int, const void *, socklen_t);
|
---|
| 171 | int shell_shutdown(int, int);
|
---|
| 172 | // select.h
|
---|
| 173 | int shell_select(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
|
---|
| 174 | // syslog.h
|
---|
| 175 | void vsyslog (int, const char *, va_list);
|
---|
| 176 | // termios.h
|
---|
| 177 | int sio_tcgetattr (int, struct termios *);
|
---|
| 178 | int sio_tcsetattr(int, int, const struct termios *);
|
---|
| 179 | // fcntl.h
|
---|
| 180 | int shell_open(const char *, int, void *arg);
|
---|
| 181 | int shell_fcntl(int fd, int cmd, void *arg);
|
---|
| 182 | // stdio.h
|
---|
| 183 | int shell_rename(const char *, const char *);
|
---|
| 184 | // stat.h
|
---|
| 185 | #define S_IFDIR 0040000
|
---|
| 186 | #define S_IFCHR 0020000
|
---|
| 187 | #define S_IFREG 0100000
|
---|
| 188 |
|
---|
| 189 | #define S_IRUSR 0400
|
---|
| 190 | #define S_IWUSR 0200
|
---|
| 191 | #define S_IRGRP 0040
|
---|
| 192 | #define S_IWGRP 0020
|
---|
| 193 | #define S_IROTH 0004
|
---|
| 194 | #define S_IWOTH 0002
|
---|
| 195 |
|
---|
| 196 | int shell_chmod(const char *, mode_t);
|
---|
| 197 | int shell_mkdir(const char *, mode_t);
|
---|
| 198 | int shell_stat(const char *__restrict, struct stat *__restrict);
|
---|
| 199 | int shell_fstat(int, struct stat *);
|
---|
| 200 | int shell_lstat(const char *__restrict, struct stat *__restrict);
|
---|
| 201 |
|
---|
| 202 | int shell_clock_getres(clockid_t clk_id, struct timespec *res);
|
---|
| 203 | int shell_clock_gettime(clockid_t clk_id, struct timespec *tp);
|
---|
| 204 | int shell_clock_settime(clockid_t clk_id, const struct timespec *tp);
|
---|
| 205 | int shell_gettimeofday(struct timeval *tp, void * tzvp);
|
---|
| 206 |
|
---|
| 207 | void shell_abort();
|
---|
| 208 | void shell_exit(int exitcd);
|
---|
| 209 | void shell_exit_group(int exitcd);
|
---|
| 210 | int shell_kill(int pid, int sig);
|
---|
| 211 |
|
---|
| 212 | void *shell_brk(void *addr);
|
---|
| 213 | void *shell_mmap2(void *start, size_t length, int prot, int flags, int fd, off_t pgoffset);
|
---|
| 214 | // sys/mman.h
|
---|
| 215 | int shell_mprotect(void *addr, size_t len, int prot);
|
---|
| 216 | // TODO
|
---|
| 217 | int shell_madvise(void *, size_t, int);
|
---|
| 218 | int shell_uname(struct utsname *);
|
---|
| 219 | // âââmusl
|
---|
| 220 |
|
---|
| 221 | // arduino.h
|
---|
| 222 | int SD_begin();
|
---|
| 223 |
|
---|
| 224 | char *basename(char *);
|
---|
| 225 | void shellif_into();
|
---|
| 226 | void shellif_outof();
|
---|
| 227 |
|
---|
| 228 | struct regs_t {
|
---|
| 229 | long a;
|
---|
| 230 | long b;
|
---|
| 231 | long c;
|
---|
| 232 | long d;
|
---|
| 233 | long e;
|
---|
| 234 | long f;
|
---|
| 235 | long n;
|
---|
| 236 | };
|
---|
| 237 |
|
---|
| 238 | void no_implement(const char *text);
|
---|
| 239 | void __mbedcall_cp_asm();
|
---|
| 240 |
|
---|
| 241 | #ifdef __cplusplus
|
---|
| 242 | extern "C" {
|
---|
| 243 | #endif
|
---|
| 244 | void Kernel_StartExternal(int argc, char **argv);
|
---|
| 245 | #ifdef __cplusplus
|
---|
| 246 | }
|
---|
| 247 | #endif
|
---|
| 248 |
|
---|
| 249 | #endif /* SHELLIF_H */
|
---|