apply review feedback

pull/100/head
Naruto TAKAHASHI 2018-07-27 00:42:25 +09:00
parent 13d028ce36
commit 7ac185c132
4 changed files with 70 additions and 2 deletions

View File

@ -8,6 +8,12 @@ It provides follows mynewt packages.
- apps/wolfsslclienttlsmn
- client-tls simple example ssl/tls client application for mn_socket.
## Prepare
install `newt` command by referencing below document.
http://mynewt.apache.org/latest/get_started/native_install/index.html
## How to setup
### delopy wolfssl source to mynewt project
@ -46,3 +52,43 @@ newt clean wolfsslclienttlsmn_sim
newt build wolfsslclienttlsmn_sim
./bin/targets/wolfsslclienttlsmn_sim/app/apps/wolfsslclienttlsmn/wolfsslclienttlsmn.elf
```
## Usage
### connect `wolfsslclienttlsmn`
`wolfssl clienttlsmn.elf` displays tty file path.
be able to connect `wolfsslclienttlsmn.elf` by using terminal softwre such as `screen` or `kermit`.
### command list
`wolfsslclienttlsmn` has below commands.
| command | argument | describe | example |
|---------|----------------------------------|----------------------------|---------------------------------------|
| time | "unix timestamp" | To set the time | "time 1532616682" |
| net | udp | create udp socket | "net udp" |
| net | tcp | create tcp socket | "net tcp" |
| net | connect "ipaddress" port | connect "ipaddress" | "net connect 93.184.216.34" 443 |
| net | close | close socket | "net close" |
| net | send "string" "ipaddress" "port" | send string | "net send "GET \r\n" 93.184.216.34 80 |
| net | recv "ipaddress" | recv from ipaddress | "net recv 93.184.216.34 80 |
| wolfssl | init | initialize wolfssl library | "wolfssl init" |
| wolfssl | connect | connect via ssl | "wolfssl connect" |
| wolfssl | write "string" | send string via ssl | "wolfssl write "GET /"" |
| wolfssl | read | recv via ssl | "wolfssl recv" |
| wolfssl | clear | finish wolfssl library | "wolfssl clear" |
### command examples
get `index.html` from `www.example.com:443`
```
net tcp
net connect
wolfssl init
wolfssl connect
wolfssl write
wolfssl read
wolfssl clear
net close
```

View File

@ -87,7 +87,7 @@ time_cli(int argc, char **argv)
}
time = strtoul(argv[1], &eptr, 0);
if (*eptr != '\0') {
console_printf("Invalid port %s\n", argv[3]);
console_printf("Invalid time %s\n", argv[3]);
return 0;
}

View File

@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/bash -e
# this scrypt deploy wolfssl and wolfcrypto source code to mynewt project
# run as bash "mynewt project root directory path"

View File

@ -0,0 +1,22 @@
#!/bin/sh -e
if [ $# -ne 1 ]; then
echo "$0 program_path"
exit 1
fi
PROGRAM=$1
TIMEOUT=10
expect -c "
set timeout ${TIMEOUT}
spawn \"${PROGRAM}\"
expect -re {uart0 at (.*)} {
send $expect_out(1,string)
send $expect_out(0,string)
send $expect_out(2,string)
}
expect \"$\"
exit 0
"
exit 0