Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8386be428c
|
@ -29,7 +29,7 @@ before_script:
|
|||
export CC65_HOME=/tmp/cc65/ && cc65 --version || true"
|
||||
|
||||
## Compile cooja.jar only when it's going to be needed
|
||||
- "[ ${BUILD_CATEGORY:-sim} = sim ] && java -version && ant -q -f tools/cooja/build.xml jar || true"
|
||||
- "[ ${BUILD_CATEGORY:-sim} = sim ] && java -version && ant -q -f tools/cooja/build.xml jar && sudo java -Xshare:dump -version || true"
|
||||
|
||||
## IMPORTANT: The commands here have to end with `|| true`,
|
||||
## because it would make the test fail if BUILD_TYPE test fails
|
||||
|
|
|
@ -64,14 +64,13 @@ SYSTEM = process.c procinit.c autostart.c elfloader.c \
|
|||
compower.c serial-line.c
|
||||
THREADS = mt.c
|
||||
LIBS = memb.c mmem.c timer.c list.c etimer.c ctimer.c energest.c rtimer.c stimer.c trickle-timer.c \
|
||||
print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c settings.c
|
||||
print-stats.c ifft.c crc16.c random.c ringbuf.c settings.c
|
||||
DEV = nullradio.c
|
||||
|
||||
include $(CONTIKI)/core/net/Makefile.uip
|
||||
include $(CONTIKI)/core/net/rpl/Makefile.rpl
|
||||
|
||||
CTK = ctk.c
|
||||
CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c
|
||||
|
||||
ifndef CONTIKI_NO_NET
|
||||
CONTIKIFILES = $(SYSTEM) $(LIBS) $(NET) $(THREADS) $(DHCP) $(DEV)
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __ABOUT_DSC_H__
|
||||
#define __ABOUT_DSC_H__
|
||||
#ifndef ABOUT_DSC_H_
|
||||
#define ABOUT_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(about_dsc);
|
||||
|
||||
#endif /* __ABOUT_DSC_H__ */
|
||||
#endif /* ABOUT_DSC_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __CALC_DSC_H__
|
||||
#define __CALC_DSC_H__
|
||||
#ifndef CALC_DSC_H_
|
||||
#define CALC_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(calc_dsc);
|
||||
|
||||
#endif /* __CALC_DSC_H__ */
|
||||
#endif /* CALC_DSC_H_ */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef __CMDD_H__
|
||||
#define __CMDD_H__
|
||||
#ifndef CMDD_H_
|
||||
#define CMDD_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
PROCESS_NAME(cmdd_process);
|
||||
|
||||
#endif /* __CMDD_H__ */
|
||||
#endif /* CMDD_H_ */
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
#ifndef __CODEPROP_H__
|
||||
#define __CODEPROP_H__
|
||||
#ifndef CODEPROP_H_
|
||||
#define CODEPROP_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
|
@ -43,4 +43,4 @@ void codeprop_start_broadcast(unsigned int len);
|
|||
void codeprop_exit_program(void);
|
||||
int codeprop_start_program(void);
|
||||
|
||||
#endif /* __CODEPROP_H__ */
|
||||
#endif /* CODEPROP_H_ */
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
#ifndef __CODEPROP_H__
|
||||
#define __CODEPROP_H__
|
||||
#ifndef CODEPROP_H_
|
||||
#define CODEPROP_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
|
@ -50,4 +50,4 @@ void codeprop_set_rate(clock_time_t time);
|
|||
void codeprop_start_broadcast(unsigned int len);
|
||||
void codeprop_start_program(void);
|
||||
|
||||
#endif /* __CODEPROP_H__ */
|
||||
#endif /* CODEPROP_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __DHCP_DSC_H__
|
||||
#define __DHCP_DSC_H__
|
||||
#ifndef DHCP_DSC_H_
|
||||
#define DHCP_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(dhcp_dsc);
|
||||
|
||||
#endif /* __DHCP_DSC_H__ */
|
||||
#endif /* DHCP_DSC_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __DIRECTORY_DSC_H__
|
||||
#define __DIRECTORY_DSC_H__
|
||||
#ifndef DIRECTORY_DSC_H_
|
||||
#define DIRECTORY_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(directory_dsc);
|
||||
|
||||
#endif /* __DIRECTORY_DSC_H__ */
|
||||
#endif /* DIRECTORY_DSC_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __EMAIL_DSC_H__
|
||||
#define __EMAIL_DSC_H__
|
||||
#ifndef EMAIL_DSC_H_
|
||||
#define EMAIL_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(email_dsc);
|
||||
|
||||
#endif /* __EMAIL_DSC_H__ */
|
||||
#endif /* EMAIL_DSC_H_ */
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __EMAIL_H__
|
||||
#define __EMAIL_H__
|
||||
#ifndef EMAIL_H_
|
||||
#define EMAIL_H_
|
||||
|
||||
PROCESS_NAME(email_process);
|
||||
|
||||
#endif /* __EMAIL_H__ */
|
||||
#endif /* EMAIL_H_ */
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __SMTP_H__
|
||||
#define __SMTP_H__
|
||||
#ifndef SMTP_H_
|
||||
#define SMTP_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -60,4 +60,4 @@ void smtp_appcall(void *state);
|
|||
|
||||
void smtp_init(void);
|
||||
|
||||
#endif /* __SMTP_H__ */
|
||||
#endif /* SMTP_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __FTP_DSC_H__
|
||||
#define __FTP_DSC_H__
|
||||
#ifndef FTP_DSC_H_
|
||||
#define FTP_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(ftp_dsc);
|
||||
|
||||
#endif /* __FTP_DSC_H__ */
|
||||
#endif /* FTP_DSC_H_ */
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __FTP_H__
|
||||
#define __FTP_H__
|
||||
#ifndef FTP_H_
|
||||
#define FTP_H_
|
||||
|
||||
PROCESS_NAME(ftp_process);
|
||||
|
||||
#endif /* __FTP_H__ */
|
||||
#endif /* FTP_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __FTPC_H__
|
||||
#define __FTPC_H__
|
||||
#ifndef FTPC_H_
|
||||
#define FTPC_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -64,4 +64,4 @@ void ftpc_timedout(void);
|
|||
void ftpc_list_file(char *filename);
|
||||
void ftpc_data(uint8_t *data, uint16_t len);
|
||||
|
||||
#endif /* __FTPC_H__ */
|
||||
#endif /* FTPC_H_ */
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTP_POST_AUTH_H__
|
||||
#define __HTTP_POST_AUTH_H__
|
||||
#ifndef HTTP_POST_AUTH_H_
|
||||
#define HTTP_POST_AUTH_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -39,4 +39,4 @@ PROCESS_NAME(http_post_auth_process);
|
|||
|
||||
int http_post_auth(const uint8_t *username_password, const char *message);
|
||||
|
||||
#endif /* __HTTP_POST_AUTH_H__ */
|
||||
#endif /* HTTP_POST_AUTH_H_ */
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_WS_H__
|
||||
#define __HTTPD_WS_H__
|
||||
#ifndef HTTPD_WS_H_
|
||||
#define HTTPD_WS_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -122,4 +122,4 @@ httpd_ws_script_t httpd_ws_get_script(struct httpd_ws_state *s);
|
|||
|
||||
PROCESS_NAME(httpd_ws_process);
|
||||
|
||||
#endif /* __HTTPD_WS_H__ */
|
||||
#endif /* HTTPD_WS_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __IRC_DSC_H__
|
||||
#define __IRC_DSC_H__
|
||||
#ifndef IRC_DSC_H_
|
||||
#define IRC_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(irc_dsc);
|
||||
|
||||
#endif /* __IRC_DSC_H__ */
|
||||
#endif /* IRC_DSC_H_ */
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __IRC_H__
|
||||
#define __IRC_H__
|
||||
#ifndef IRC_H_
|
||||
#define IRC_H_
|
||||
|
||||
PROCESS_NAME(irc_process);
|
||||
|
||||
#endif /* __IRC_H__ */
|
||||
#endif /* IRC_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __IRCC_H__
|
||||
#define __IRCC_H__
|
||||
#ifndef IRCC_H_
|
||||
#define IRCC_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -75,4 +75,4 @@ void ircc_closed(struct ircc_state *s);
|
|||
|
||||
void ircc_quit(struct ircc_state *s);
|
||||
|
||||
#endif /* __IRCC_H__ */
|
||||
#endif /* IRCC_H_ */
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __JSON_H__
|
||||
#define __JSON_H__
|
||||
#ifndef JSON_H_
|
||||
#define JSON_H_
|
||||
|
||||
#define JSON_TYPE_ARRAY '['
|
||||
#define JSON_TYPE_OBJECT '{'
|
||||
|
@ -67,4 +67,4 @@ enum {
|
|||
|
||||
#define JSON_CONTENT_TYPE "application/json"
|
||||
|
||||
#endif /* __JSON_H__ */
|
||||
#endif /* JSON_H_ */
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
#ifndef __JSONPARSE_H__
|
||||
#define __JSONPARSE_H__
|
||||
#ifndef JSONPARSE_H_
|
||||
#define JSONPARSE_H_
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#include "json.h"
|
||||
|
@ -88,4 +88,4 @@ int jsonparse_get_type(struct jsonparse_state *state);
|
|||
/* compare the JSON value with the specified string */
|
||||
int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str);
|
||||
|
||||
#endif /* __JSONPARSE_H__ */
|
||||
#endif /* JSONPARSE_H_ */
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __JSONTREE_H__
|
||||
#define __JSONTREE_H__
|
||||
#ifndef JSONTREE_H_
|
||||
#define JSONTREE_H_
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#include "json.h"
|
||||
|
@ -132,4 +132,4 @@ int jsontree_print_next(struct jsontree_context *js_ctx);
|
|||
struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx,
|
||||
int type);
|
||||
|
||||
#endif /* __JSONTREE_H__ */
|
||||
#endif /* JSONTREE_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __NETCONF_DSC_H__
|
||||
#define __NETCONF_DSC_H__
|
||||
#ifndef NETCONF_DSC_H_
|
||||
#define NETCONF_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(netconf_dsc);
|
||||
|
||||
#endif /* __NETCONF_DSC_H__ */
|
||||
#endif /* NETCONF_DSC_H_ */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef __PING6_H__
|
||||
#define __PING6_H__
|
||||
#ifndef PING6_H_
|
||||
#define PING6_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
PROCESS_NAME(ping6_process);
|
||||
|
||||
#endif /* __PING6_H__ */
|
||||
#endif /* PING6_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __PROCESSES_DSC_H__
|
||||
#define __PROCESSES_DSC_H__
|
||||
#ifndef PROCESSES_DSC_H_
|
||||
#define PROCESSES_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(processes_dsc);
|
||||
|
||||
#endif /* __PROCESSES_DSC_H__ */
|
||||
#endif /* PROCESSES_DSC_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __PROGRAM_HANDLER_H__
|
||||
#define __PROGRAM_HANDLER_H__
|
||||
#ifndef PROGRAM_HANDLER_H_
|
||||
#define PROGRAM_HANDLER_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
|
@ -48,4 +48,4 @@ void program_handler_setscreensaver(char *name);
|
|||
void program_handler_add(struct dsc *dsc, char *menuname,
|
||||
unsigned char desktop);
|
||||
|
||||
#endif /* __PROGRAM_HANDLER_H__ */
|
||||
#endif /* PROGRAM_HANDLER_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SERIAL_SHELL_H__
|
||||
#define __SERIAL_SHELL_H__
|
||||
#ifndef SERIAL_SHELL_H_
|
||||
#define SERIAL_SHELL_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
void serial_shell_init(void);
|
||||
|
||||
#endif /* __SERIAL_SHELL_H__ */
|
||||
#endif /* SERIAL_SHELL_H_ */
|
||||
|
|
|
@ -5,7 +5,7 @@ shell_src = shell.c shell-reboot.c \
|
|||
shell-rime-ping.c shell-rime-sniff.c shell-rime-netcmd.c \
|
||||
shell-rime-debug.c shell-rime-debug-runicast.c shell-coffee.c \
|
||||
shell-wget.c shell-httpd.c shell-irc.c \
|
||||
shell-checkpoint.c shell-power.c \
|
||||
shell-power.c \
|
||||
shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c \
|
||||
shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \
|
||||
shell-rime-unicast.c \
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_BASE64_H__
|
||||
#define __SHELL_BASE64_H__
|
||||
#ifndef SHELL_BASE64_H_
|
||||
#define SHELL_BASE64_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_base64_init(void);
|
||||
|
||||
#endif /* __SHELL_BASE64_H__ */
|
||||
#endif /* SHELL_BASE64_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_BLINK_H__
|
||||
#define __SHELL_BLINK_H__
|
||||
#ifndef SHELL_BLINK_H_
|
||||
#define SHELL_BLINK_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_blink_init(void);
|
||||
|
||||
#endif /* __SHELL_BLINK_H__ */
|
||||
#endif /* SHELL_BLINK_H_ */
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "shell.h"
|
||||
|
||||
#include "cfs/cfs.h"
|
||||
#include "cfs/cfs-coffee.h"
|
||||
#include "lib/checkpoint.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(shell_checkpoint_process, "checkpoint");
|
||||
SHELL_COMMAND(checkpoint_command,
|
||||
"checkpoint",
|
||||
"checkpoint <filename>: checkpoint local state to file",
|
||||
&shell_checkpoint_process);
|
||||
PROCESS(shell_rollback_process, "rollback");
|
||||
SHELL_COMMAND(rollback_command,
|
||||
"rollback",
|
||||
"rollback <filename>: rollback local state from file",
|
||||
&shell_rollback_process);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_checkpoint_process, ev, data)
|
||||
{
|
||||
int fd = 0;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
/* Make sure file does not already exist */
|
||||
cfs_remove(data);
|
||||
|
||||
cfs_coffee_reserve(data, checkpoint_arch_size());
|
||||
fd = cfs_open(data, CFS_WRITE);
|
||||
|
||||
if(fd < 0) {
|
||||
shell_output_str(&checkpoint_command,
|
||||
"checkpoint: could not open file for writing: ", data);
|
||||
} else {
|
||||
shell_output_str(&checkpoint_command, "checkpoint to: ", data);
|
||||
checkpoint_checkpoint(fd);
|
||||
cfs_close(fd);
|
||||
shell_output_str(&checkpoint_command, "checkpointing done", "");
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_rollback_process, ev, data)
|
||||
{
|
||||
int fd = 0;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
fd = cfs_open(data, CFS_READ);
|
||||
|
||||
if(fd < 0) {
|
||||
shell_output_str(&rollback_command,
|
||||
"rollback: could not open file for reading: ", data);
|
||||
} else {
|
||||
shell_output_str(&rollback_command, "rollback from: ", data);
|
||||
checkpoint_rollback(fd);
|
||||
cfs_close(fd);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
shell_checkpoint_init(void)
|
||||
{
|
||||
checkpoint_init();
|
||||
shell_register_command(&checkpoint_command);
|
||||
shell_register_command(&rollback_command);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_CHECKPOINT_H__
|
||||
#define __SHELL_CHECKPOINT_H__
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_checkpoint_init(void);
|
||||
|
||||
#endif /* __SHELL_CHECKPOINT_H__ */
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_COFFEE_H__
|
||||
#define __SHELL_COFFEE_H__
|
||||
#ifndef SHELL_COFFEE_H_
|
||||
#define SHELL_COFFEE_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_coffee_init(void);
|
||||
|
||||
#endif /* __SHELL_COFFEE_H__ */
|
||||
#endif /* SHELL_COFFEE_H_ */
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_CRC_H__
|
||||
#define __SHELL_CRC_H__
|
||||
#ifndef SHELL_CRC_H_
|
||||
#define SHELL_CRC_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_crc_init(void);
|
||||
|
||||
#endif /* __SHELL_CRC_H__ */
|
||||
#endif /* SHELL_CRC_H_ */
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_DOWNLOAD_H__
|
||||
#define __SHELL_DOWNLOAD_H__
|
||||
#ifndef SHELL_DOWNLOAD_H_
|
||||
#define SHELL_DOWNLOAD_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_download_init(void);
|
||||
|
||||
#endif /* __SHELL_DOWNLOAD_H__ */
|
||||
#endif /* SHELL_DOWNLOAD_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __SHELL_DSC_H__
|
||||
#define __SHELL_DSC_H__
|
||||
#ifndef SHELL_DSC_H_
|
||||
#define SHELL_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(shell_dsc);
|
||||
|
||||
#endif /* __SHELL_DSC_H__ */
|
||||
#endif /* SHELL_DSC_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_EXEC_H__
|
||||
#define __SHELL_EXEC_H__
|
||||
#ifndef SHELL_EXEC_H_
|
||||
#define SHELL_EXEC_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_exec_init(void);
|
||||
|
||||
#endif /* __SHELL_EXEC_H__ */
|
||||
#endif /* SHELL_EXEC_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_FILE_H__
|
||||
#define __SHELL_FILE_H__
|
||||
#ifndef SHELL_FILE_H_
|
||||
#define SHELL_FILE_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_file_init(void);
|
||||
|
||||
#endif /* __SHELL_FILE_H__ */
|
||||
#endif /* SHELL_FILE_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_HTTPD_H__
|
||||
#define __SHELL_HTTPD_H__
|
||||
#ifndef SHELL_HTTPD_H_
|
||||
#define SHELL_HTTPD_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_httpd_init(void);
|
||||
|
||||
#endif /* __SHELL_HTTPD_H__ */
|
||||
#endif /* SHELL_HTTPD_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_IRC_H__
|
||||
#define __SHELL_IRC_H__
|
||||
#ifndef SHELL_IRC_H_
|
||||
#define SHELL_IRC_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_irc_init(void);
|
||||
|
||||
#endif /* __SHELL_IRC_H__ */
|
||||
#endif /* SHELL_IRC_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_MEMDEBUG_H__
|
||||
#define __SHELL_MEMDEBUG_H__
|
||||
#ifndef SHELL_MEMDEBUG_H_
|
||||
#define SHELL_MEMDEBUG_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_memdebug_init(void);
|
||||
|
||||
#endif /* __SHELL_MEMDEBUG_H__ */
|
||||
#endif /* SHELL_MEMDEBUG_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_NETFILE_H__
|
||||
#define __SHELL_NETFILE_H__
|
||||
#ifndef SHELL_NETFILE_H_
|
||||
#define SHELL_NETFILE_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_netfile_init(void);
|
||||
|
||||
#endif /* __SHELL_NETFILE_H__ */
|
||||
#endif /* SHELL_NETFILE_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_NETPERF_H__
|
||||
#define __SHELL_NETPERF_H__
|
||||
#ifndef SHELL_NETPERF_H_
|
||||
#define SHELL_NETPERF_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_netperf_init(void);
|
||||
|
||||
#endif /* __SHELL_NETPERF_H__ */
|
||||
#endif /* SHELL_NETPERF_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_NETSTAT_H__
|
||||
#define __SHELL_NETSTAT_H__
|
||||
#ifndef SHELL_NETSTAT_H_
|
||||
#define SHELL_NETSTAT_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_netstat_init(void);
|
||||
|
||||
#endif /* __SHELL_NETSTAT_H__ */
|
||||
#endif /* SHELL_NETSTAT_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_PING_H__
|
||||
#define __SHELL_PING_H__
|
||||
#ifndef SHELL_PING_H_
|
||||
#define SHELL_PING_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_ping_init(void);
|
||||
|
||||
#endif /* __SHELL_PING_H__ */
|
||||
#endif /* SHELL_PING_H_ */
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_POWER_H__
|
||||
#define __SHELL_POWER_H__
|
||||
#ifndef SHELL_POWER_H_
|
||||
#define SHELL_POWER_H_
|
||||
|
||||
void shell_power_init(void);
|
||||
|
||||
#endif /* __SHELL_POWER_H__ */
|
||||
#endif /* SHELL_POWER_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_PROFILE_H__
|
||||
#define __SHELL_PROFILE_H__
|
||||
#ifndef SHELL_PROFILE_H_
|
||||
#define SHELL_PROFILE_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_profile_init(void);
|
||||
|
||||
#endif /* __SHELL_PROFILE_H__ */
|
||||
#endif /* SHELL_PROFILE_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_PS_H__
|
||||
#define __SHELL_PS_H__
|
||||
#ifndef SHELL_PS_H_
|
||||
#define SHELL_PS_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_ps_init(void);
|
||||
|
||||
#endif /* __SHELL_PS_H__ */
|
||||
#endif /* SHELL_PS_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_REBOOT_H__
|
||||
#define __SHELL_REBOOT_H__
|
||||
#ifndef SHELL_REBOOT_H_
|
||||
#define SHELL_REBOOT_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_reboot_init(void);
|
||||
|
||||
#endif /* __SHELL_REBOOT_H__ */
|
||||
#endif /* SHELL_REBOOT_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_DEBUG_RUNICAST_H__
|
||||
#define __SHELL_RIME_DEBUG_RUNICAST_H__
|
||||
#ifndef SHELL_RIME_DEBUG_RUNICAST_H_
|
||||
#define SHELL_RIME_DEBUG_RUNICAST_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_rime_debug_runicast_init(void);
|
||||
|
||||
#endif /* __SHELL_RIME_DEBUG_RUNICAST_H__ */
|
||||
#endif /* SHELL_RIME_DEBUG_RUNICAST_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_DEBUG_H__
|
||||
#define __SHELL_RIME_DEBUG_H__
|
||||
#ifndef SHELL_RIME_DEBUG_H_
|
||||
#define SHELL_RIME_DEBUG_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_rime_debug_init(void);
|
||||
|
||||
#endif /* __SHELL_RIME_DEBUG_H__ */
|
||||
#endif /* SHELL_RIME_DEBUG_H_ */
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_NEIGHBORS_H__
|
||||
#define __SHELL_RIME_NEIGHBORS_H__
|
||||
#ifndef SHELL_RIME_NEIGHBORS_H_
|
||||
#define SHELL_RIME_NEIGHBORS_H_
|
||||
|
||||
void shell_rime_neighbors_init(void);
|
||||
|
||||
#endif /* __SHELL-RIME_-NEIGHBORS_H__ */
|
||||
#endif /* SHELL-RIME_-NEIGHBORS_H_ */
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_NETCMD_H__
|
||||
#define __SHELL_RIME_NETCMD_H__
|
||||
#ifndef SHELL_RIME_NETCMD_H_
|
||||
#define SHELL_RIME_NETCMD_H_
|
||||
|
||||
void shell_rime_netcmd_init(void);
|
||||
|
||||
#endif /* __SHELL_RIME_NETCMD_H__ */
|
||||
#endif /* SHELL_RIME_NETCMD_H_ */
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_PING_H__
|
||||
#define __SHELL_RIME_PING_H__
|
||||
#ifndef SHELL_RIME_PING_H_
|
||||
#define SHELL_RIME_PING_H_
|
||||
|
||||
void shell_rime_ping_init(void);
|
||||
|
||||
#endif /* __SHELL-RIME_-PING_H__ */
|
||||
#endif /* SHELL-RIME_-PING_H_ */
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_SENDCMD_H__
|
||||
#define __SHELL_RIME_SENDCMD_H__
|
||||
#ifndef SHELL_RIME_SENDCMD_H_
|
||||
#define SHELL_RIME_SENDCMD_H_
|
||||
|
||||
void shell_rime_sendcmd_init(void);
|
||||
|
||||
#endif /* __SHELL_RIME_SENDCMD_H__ */
|
||||
#endif /* SHELL_RIME_SENDCMD_H_ */
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_SNIFF_H__
|
||||
#define __SHELL_RIME_SNIFF_H__
|
||||
#ifndef SHELL_RIME_SNIFF_H_
|
||||
#define SHELL_RIME_SNIFF_H_
|
||||
|
||||
void shell_rime_sniff_init(void);
|
||||
|
||||
#endif /* __SHELL_RIME_SNIFF_H__ */
|
||||
#endif /* SHELL_RIME_SNIFF_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_UNICAST_H__
|
||||
#define __SHELL_RIME_UNICAST_H__
|
||||
#ifndef SHELL_RIME_UNICAST_H_
|
||||
#define SHELL_RIME_UNICAST_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_rime_unicast_init(void);
|
||||
|
||||
#endif /* __SHELL_RIME_UNICAST_H__ */
|
||||
#endif /* SHELL_RIME_UNICAST_H_ */
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RIME_H__
|
||||
#define __SHELL_RIME_H__
|
||||
#ifndef SHELL_RIME_H_
|
||||
#define SHELL_RIME_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
|
@ -86,4 +86,4 @@ void shell_rime_init(void);
|
|||
|
||||
extern struct collect_conn shell_collect_conn;
|
||||
|
||||
#endif /* __SHELL_RIME_H__ */
|
||||
#endif /* SHELL_RIME_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RSH_H__
|
||||
#define __SHELL_RSH_H__
|
||||
#ifndef SHELL_RSH_H_
|
||||
#define SHELL_RSH_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_rsh_init(void);
|
||||
|
||||
#endif /* __SHELL_RSH_H__ */
|
||||
#endif /* SHELL_RSH_H_ */
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_RUN_H__
|
||||
#define __SHELL_RUN_H__
|
||||
#ifndef SHELL_RUN_H_
|
||||
#define SHELL_RUN_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_run_init(void);
|
||||
|
||||
#endif /* __SHELL_RUN_H__ */
|
||||
#endif /* SHELL_RUN_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_SENDTEST_H__
|
||||
#define __SHELL_SENDTEST_H__
|
||||
#ifndef SHELL_SENDTEST_H_
|
||||
#define SHELL_SENDTEST_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_sendtest_init(void);
|
||||
|
||||
#endif /* __SHELL_SENDTEST_H__ */
|
||||
#endif /* SHELL_SENDTEST_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_SKY_H__
|
||||
#define __SHELL_SKY_H__
|
||||
#ifndef SHELL_SKY_H_
|
||||
#define SHELL_SKY_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_sky_init(void);
|
||||
|
||||
#endif /* __SHELL_SKY_H__ */
|
||||
#endif /* SHELL_SKY_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_TCPSEND_H__
|
||||
#define __SHELL_TCPSEND_H__
|
||||
#ifndef SHELL_TCPSEND_H_
|
||||
#define SHELL_TCPSEND_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_tcpsend_init(void);
|
||||
|
||||
#endif /* __SHELL_TCPSEND_H__ */
|
||||
#endif /* SHELL_TCPSEND_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_TEXT_H__
|
||||
#define __SHELL_TEXT_H__
|
||||
#ifndef SHELL_TEXT_H_
|
||||
#define SHELL_TEXT_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_text_init(void);
|
||||
|
||||
#endif /* __SHELL_TEXT_H__ */
|
||||
#endif /* SHELL_TEXT_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_TIME_H__
|
||||
#define __SHELL_TIME_H__
|
||||
#ifndef SHELL_TIME_H_
|
||||
#define SHELL_TIME_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_time_init(void);
|
||||
|
||||
#endif /* __SHELL_TIME_H__ */
|
||||
#endif /* SHELL_TIME_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_UDPSEND_H__
|
||||
#define __SHELL_UDPSEND_H__
|
||||
#ifndef SHELL_UDPSEND_H_
|
||||
#define SHELL_UDPSEND_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_udpsend_init(void);
|
||||
|
||||
#endif /* __SHELL_UDPSEND_H__ */
|
||||
#endif /* SHELL_UDPSEND_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_VARS_H__
|
||||
#define __SHELL_VARS_H__
|
||||
#ifndef SHELL_VARS_H_
|
||||
#define SHELL_VARS_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_vars_init(void);
|
||||
|
||||
#endif /* __SHELL_VARS_H__ */
|
||||
#endif /* SHELL_VARS_H_ */
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_WGET_H__
|
||||
#define __SHELL_WGET_H__
|
||||
#ifndef SHELL_WGET_H_
|
||||
#define SHELL_WGET_H_
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_wget_init(void);
|
||||
|
||||
#endif /* __SHELL_WGET_H__ */
|
||||
#endif /* SHELL_WGET_H_ */
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_H__
|
||||
#define __SHELL_H__
|
||||
#ifndef SHELL_H_
|
||||
#define SHELL_H_
|
||||
|
||||
#include "sys/process.h"
|
||||
|
||||
|
@ -374,7 +374,6 @@ struct shell_input {
|
|||
|
||||
#include "shell-base64.h"
|
||||
#include "shell-blink.h"
|
||||
#include "shell-checkpoint.h"
|
||||
#include "shell-collect-view.h"
|
||||
#include "shell-coffee.h"
|
||||
#include "shell-download.h"
|
||||
|
@ -411,7 +410,7 @@ struct shell_input {
|
|||
#include "shell-vars.h"
|
||||
#include "shell-wget.h"
|
||||
|
||||
#endif /* __SHELL_H__ */
|
||||
#endif /* SHELL_H_ */
|
||||
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __CMD_H__
|
||||
#define __CMD_H__
|
||||
#ifndef CMD_H_
|
||||
#define CMD_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
|
@ -50,4 +50,4 @@ const cmd_handler_t cmd_handlers[] = {__VA_ARGS__, NULL}
|
|||
void cmd_input(const uint8_t *data, int data_len);
|
||||
void cmd_send(const uint8_t *data, int data_len);
|
||||
|
||||
#endif /* __CMD_H__ */
|
||||
#endif /* CMD_H_ */
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __PACKETUTILS_H__
|
||||
#define __PACKETUTILS_H__
|
||||
#ifndef PACKETUTILS_H_
|
||||
#define PACKETUTILS_H_
|
||||
|
||||
int packetutils_serialize_atts(uint8_t *data, int size);
|
||||
|
||||
int packetutils_deserialize_atts(const uint8_t *data, int size);
|
||||
|
||||
#endif /* __PACKETUTILS_H__ */
|
||||
#endif /* PACKETUTILS_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __SIMPLETELNET_H__
|
||||
#define __SIMPLETELNET_H__
|
||||
#ifndef SIMPLETELNET_H_
|
||||
#define SIMPLETELNET_H_
|
||||
|
||||
#ifdef TELNET_CONF_WINDOW_WIDTH
|
||||
#define TELNET_WINDOW_WIDTH TELNET_CONF_WINDOW_WIDTH
|
||||
|
@ -63,4 +63,4 @@
|
|||
|
||||
void simpletelnet_init(char *arg);
|
||||
|
||||
#endif /* __SIMPLETELNET_H__ */
|
||||
#endif /* SIMPLETELNET_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __TELNET_DSC_H__
|
||||
#define __TELNET_DSC_H__
|
||||
#ifndef TELNET_DSC_H_
|
||||
#define TELNET_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(telnet_dsc);
|
||||
|
||||
#endif /* __TELNET_DSC_H__ */
|
||||
#endif /* TELNET_DSC_H_ */
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __TELNET_H__
|
||||
#define __TELNET_H__
|
||||
#ifndef TELNET_H_
|
||||
#define TELNET_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -57,4 +57,4 @@ void telnet_sent(struct telnet_state *s);
|
|||
void telnet_aborted(struct telnet_state *s);
|
||||
void telnet_timedout(struct telnet_state *s);
|
||||
void telnet_newdata(struct telnet_state *s, char *data, uint16_t len);
|
||||
#endif /* __TELNET_H__ */
|
||||
#endif /* TELNET_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __TELNETD_DSC_H__
|
||||
#define __TELNETD_DSC_H__
|
||||
#ifndef TELNETD_DSC_H_
|
||||
#define TELNETD_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(telnetd_dsc);
|
||||
|
||||
#endif /* __TELNETD_DSC_H__ */
|
||||
#endif /* TELNETD_DSC_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __TELNETD_H__
|
||||
#define __TELNETD_H__
|
||||
#ifndef TELNETD_H_
|
||||
#define TELNETD_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
|
@ -47,4 +47,4 @@ void telnetd_gui_output(const char *str1, int len1, const char *str2, int len2);
|
|||
void telnetd_gui_quit(void);
|
||||
void telnetd_quit(void);
|
||||
|
||||
#endif /* __TELNETD_H__ */
|
||||
#endif /* TELNETD_H_ */
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
vnc_src = vnc.c vnc-viewer.c vnc-draw.c
|
||||
vnc_dsc = vnc-dsc.c
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki VNC client.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __VNC_DRAW_H__
|
||||
#define __VNC_DRAW_H__
|
||||
|
||||
#include "net/uip_arch.h"
|
||||
|
||||
/* Pointer to the bitmap area in memory. */
|
||||
extern uint8_t vnc_draw_bitmap[];
|
||||
|
||||
/* Initialize the vnc-draw module. */
|
||||
void vnc_draw_init(void);
|
||||
|
||||
/* Draw one line of pixels starting at point (x, y). The pixel data is
|
||||
given by the "data" argument and the length of data is given by the
|
||||
"datalen" argument. The data format is one pixel per byte in bgr233
|
||||
format (bbgggrrr). */
|
||||
void vnc_draw_pixelline(uint16_t x, uint16_t y,
|
||||
uint8_t *data, uint16_t datalen);
|
||||
|
||||
/* The following functions should return the x and y coordinates and
|
||||
the width and height of the viewport. */
|
||||
uint16_t vnc_draw_viewport_x(void);
|
||||
uint16_t vnc_draw_viewport_y(void);
|
||||
uint16_t vnc_draw_viewport_w(void);
|
||||
uint16_t vnc_draw_viewport_h(void);
|
||||
|
||||
#endif /* __VNC_DRAW_H__ */
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki desktop environment
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if CTK_CONF_ICON_BITMAPS
|
||||
static unsigned char vncicon_bitmap[3*3*8] = {
|
||||
0x00, 0x7e, 0x40, 0x73, 0x46, 0x4c, 0x18, 0x13,
|
||||
0x00, 0x00, 0xff, 0x81, 0x34, 0xc9, 0x00, 0xb6,
|
||||
0x00, 0x7e, 0x02, 0xce, 0x72, 0x32, 0x18, 0x48,
|
||||
|
||||
0x30, 0x27, 0x24, 0x20, 0x37, 0x24, 0x20, 0x33,
|
||||
0x00, 0x7b, 0x42, 0x00, 0x7b, 0x42, 0x00, 0x3b,
|
||||
0x0c, 0x24, 0x24, 0x04, 0xa4, 0x24, 0x04, 0x4c,
|
||||
|
||||
0x12, 0x19, 0x4c, 0x46, 0x63, 0x40, 0x7c, 0x00,
|
||||
0x22, 0x91, 0x00, 0xc4, 0x81, 0xff, 0x00, 0x00,
|
||||
0x08, 0x18, 0x32, 0x62, 0xc6, 0x02, 0x3e, 0x00
|
||||
};
|
||||
#endif /* CTK_CONF_ICON_BITMAPS */
|
||||
|
||||
#if CTK_CONF_ICON_TEXTMAPS
|
||||
static char vncicon_textmap[9] = {
|
||||
'V', 'N', 'C',
|
||||
'c', 'l', 'i',
|
||||
'e', 'n', 't'
|
||||
};
|
||||
#endif /* CTK_CONF_ICON_TEXTMAPS */
|
||||
|
||||
#if CTK_CONF_ICONS
|
||||
static struct ctk_icon vnc_icon =
|
||||
{CTK_ICON("VNC viewer", vncicon_bitmap, vncicon_textmap)};
|
||||
#endif /* CTK_CONF_ICONS */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
DSC(vnc_dsc,
|
||||
"Remote control your PC using Contiki",
|
||||
"vnc.prg",
|
||||
vnc_process,
|
||||
&vnc_icon);
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki desktop environment
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __VNC_DSC_H__
|
||||
#define __VNC_DSC_H__
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(vnc_dsc);
|
||||
|
||||
#endif /* __VNC_DSC_H__ */
|
|
@ -1,754 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* A micro implementation of a VNC client. VNC is a protocol for
|
||||
remote network displays. See http://www.uk.research.att.com/vnc/
|
||||
for information about VNC.
|
||||
*/
|
||||
|
||||
#include "vnc-draw.h"
|
||||
#include "net/uip.h"
|
||||
#include "vnc-viewer.h"
|
||||
|
||||
#include <string.h> /* XXX for memcpy */
|
||||
#include <stdio.h> /* XXX for printf */
|
||||
|
||||
/* RFB server initial handshaking string. */
|
||||
#define RFB_SERVER_VERSION_STRING rfb_server_version_string
|
||||
|
||||
/* "RFB 003.003" */
|
||||
static uint8_t rfb_server_version_string[12] =
|
||||
{82,70,66,32,48,48,51,46,48,48,51,10};
|
||||
|
||||
#if 0
|
||||
#define PRINTF(x)
|
||||
#else
|
||||
#define PRINTF(x) printf x
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif
|
||||
|
||||
static struct vnc_viewer_state vnc_viewer_state;
|
||||
#define vs (&vnc_viewer_state)
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_init(void)
|
||||
{
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_close(void)
|
||||
{
|
||||
vs->close = 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_connect(uint16_t *server, uint8_t display)
|
||||
{
|
||||
struct uip_conn *conn;
|
||||
|
||||
vnc_draw_init();
|
||||
|
||||
memset(vs, 0, sizeof(struct vnc_viewer_state));
|
||||
conn = uip_connect((uip_ipaddr_t *)server, uip_htons(5900 + display));
|
||||
if(conn == NULL) {
|
||||
return;
|
||||
}
|
||||
tcp_markconn(conn, NULL);
|
||||
|
||||
vs->close = 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
senddata(void)
|
||||
{
|
||||
register uint8_t *dataptr;
|
||||
uint16_t dataleft;
|
||||
|
||||
dataptr = (uint8_t *)uip_appdata;
|
||||
|
||||
switch(vs->sendmsg) {
|
||||
case VNC_SEND_VERSION:
|
||||
PRINTF(("Sending VERSION_STRING\n"));
|
||||
uip_send(RFB_SERVER_VERSION_STRING, sizeof(RFB_SERVER_VERSION_STRING));
|
||||
break;
|
||||
case VNC_SEND_AUTH:
|
||||
/* Send 16 bytes of encrypted challange response. */
|
||||
/* XXX: not implemented. */
|
||||
PRINTF(("Sending AUTH\n"));
|
||||
uip_send(uip_appdata, 16);
|
||||
break;
|
||||
case VNC_SEND_CINIT:
|
||||
PRINTF(("Sending CINIT\n"));
|
||||
/* Send one byte of client init. */
|
||||
*(uint8_t *)dataptr = 1;
|
||||
uip_send(uip_appdata, 1);
|
||||
break;
|
||||
case VNC_SEND_PFMT:
|
||||
PRINTF(("Sending PFMT\n"));
|
||||
((struct rfb_set_pixel_format *)dataptr)->type = RFB_SET_PIXEL_FORMAT;
|
||||
|
||||
/* Set to BGR233 pixel format. */
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.bps = 8;
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.depth = 8;
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.endian = 1;
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.truecolor = 1;
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.red_max = uip_htons(7);
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.green_max = uip_htons(7);
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.blue_max = uip_htons(3);
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.red_shift = 0;
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.green_shift = 3;
|
||||
((struct rfb_set_pixel_format *)dataptr)->format.blue_shift = 6;
|
||||
|
||||
uip_send(uip_appdata, sizeof(struct rfb_set_pixel_format));
|
||||
|
||||
break;
|
||||
case VNC_SEND_ENCODINGS:
|
||||
PRINTF(("Sending ENCODINGS\n"));
|
||||
((struct rfb_set_encodings *)dataptr)->type = RFB_SET_ENCODINGS;
|
||||
((struct rfb_set_encodings *)dataptr)->encodings = uip_htons(1);
|
||||
dataptr += sizeof(struct rfb_set_encodings);
|
||||
dataptr[0] = dataptr[1] = dataptr[2] = 0;
|
||||
dataptr[3] = RFB_ENC_RAW;
|
||||
/* ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[4] =
|
||||
((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[5] =
|
||||
((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[6] = 0;
|
||||
((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[7] = RFB_ENC_RRE;*/
|
||||
uip_send(uip_appdata, sizeof(struct rfb_set_encodings) + 4);
|
||||
break;
|
||||
case VNC_SEND_UPDATERQ:
|
||||
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
||||
((struct rfb_fb_update_request *)dataptr)->incremental = 0;
|
||||
((struct rfb_fb_update_request *)dataptr)->x = uip_htons(vnc_draw_viewport_x());
|
||||
((struct rfb_fb_update_request *)dataptr)->y = uip_htons(vnc_draw_viewport_y());
|
||||
((struct rfb_fb_update_request *)dataptr)->w = uip_htons(vnc_draw_viewport_w());
|
||||
((struct rfb_fb_update_request *)dataptr)->h = uip_htons(vnc_draw_viewport_h());
|
||||
uip_send(uip_appdata, sizeof(struct rfb_fb_update_request));
|
||||
break;
|
||||
case VNC_SEND_UPDATERQ_INC:
|
||||
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
||||
((struct rfb_fb_update_request *)dataptr)->incremental = 1;
|
||||
((struct rfb_fb_update_request *)dataptr)->x = uip_htons(vnc_draw_viewport_x());
|
||||
((struct rfb_fb_update_request *)dataptr)->y = uip_htons(vnc_draw_viewport_y());
|
||||
((struct rfb_fb_update_request *)dataptr)->w = uip_htons(vnc_draw_viewport_w());
|
||||
((struct rfb_fb_update_request *)dataptr)->h = uip_htons(vnc_draw_viewport_h());
|
||||
uip_send(uip_appdata, sizeof(struct rfb_fb_update_request));
|
||||
break;
|
||||
|
||||
case VNC_SEND_EVENTS:
|
||||
|
||||
dataleft = uip_mss();
|
||||
|
||||
vs->eventptr_unacked = vs->eventptr_acked;
|
||||
while(vs->eventptr_unacked != vs->eventptr_next &&
|
||||
dataleft > sizeof(struct rfb_key_event)) {
|
||||
switch(vs->event_queue[vs->eventptr_unacked].type) {
|
||||
case VNC_POINTER_EVENT:
|
||||
((struct rfb_pointer_event *)dataptr)->type = RFB_POINTER_EVENT;
|
||||
((struct rfb_pointer_event *)dataptr)->buttonmask =
|
||||
vs->event_queue[vs->eventptr_unacked].ev.ptr.buttonmask;
|
||||
((struct rfb_pointer_event *)dataptr)->x =
|
||||
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.x);
|
||||
((struct rfb_pointer_event *)dataptr)->y =
|
||||
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.y);
|
||||
/* uip_send(uip_appdata, sizeof(struct rfb_pointer_event));*/
|
||||
dataptr += sizeof(struct rfb_pointer_event);
|
||||
dataleft -= sizeof(struct rfb_pointer_event);
|
||||
break;
|
||||
case VNC_KEY_EVENT:
|
||||
PRINTF(("Send key event.\n"));
|
||||
((struct rfb_key_event *)dataptr)->type = RFB_KEY_EVENT;
|
||||
((struct rfb_key_event *)dataptr)->down =
|
||||
vs->event_queue[vs->eventptr_unacked].ev.key.down;
|
||||
((struct rfb_key_event *)dataptr)->key[0] =
|
||||
((struct rfb_key_event *)dataptr)->key[1];
|
||||
((struct rfb_key_event *)dataptr)->key[2] =
|
||||
vs->event_queue[vs->eventptr_unacked].ev.key.key >> 8;
|
||||
|
||||
((struct rfb_key_event *)dataptr)->key[3] =
|
||||
vs->event_queue[vs->eventptr_unacked].ev.key.key & 0xff;
|
||||
/* uip_send(uip_appdata, sizeof(struct rfb_key_event));*/
|
||||
dataptr += sizeof(struct rfb_key_event);
|
||||
dataleft -= sizeof(struct rfb_key_event);
|
||||
break;
|
||||
case VNC_UPDATERQ_EVENT:
|
||||
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
||||
((struct rfb_fb_update_request *)dataptr)->incremental = 0;
|
||||
((struct rfb_fb_update_request *)dataptr)->x =
|
||||
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.x);
|
||||
((struct rfb_fb_update_request *)dataptr)->y =
|
||||
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.y);
|
||||
((struct rfb_fb_update_request *)dataptr)->w =
|
||||
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.w);
|
||||
((struct rfb_fb_update_request *)dataptr)->h =
|
||||
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.h);
|
||||
/* uip_send(uip_appdata, sizeof(struct rfb_fb_update_request)); */
|
||||
dataptr += sizeof(struct rfb_fb_update_request);
|
||||
dataleft -= sizeof(struct rfb_fb_update_request);
|
||||
break;
|
||||
}
|
||||
vs->eventptr_unacked = (vs->eventptr_unacked + 1) % VNC_EVENTQUEUE_SIZE;
|
||||
}
|
||||
|
||||
uip_send(uip_appdata, uip_mss() - dataleft);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
buffer_data(uint8_t *data, uint16_t datalen)
|
||||
{
|
||||
PRINTF(("Buffering %d bytes of data\n", datalen));
|
||||
|
||||
if(vs->buffersize + datalen > VNC_BUFFERSIZE) {
|
||||
PRINTF(("Out of buffer space!\n"));
|
||||
vs->buffersize = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(&(vs->buffer[vs->buffersize]), data, datalen);
|
||||
|
||||
vs->buffersize += datalen;
|
||||
vs->bufferleft -= datalen;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
clearbuffer(void)
|
||||
{
|
||||
PRINTF(("Clearing buffer\n"));
|
||||
vs->buffersize = 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Returns: the amount of bytes actually read. */
|
||||
static uint16_t
|
||||
recv_rectstate(uint8_t *dataptr, uint16_t datalen)
|
||||
{
|
||||
uint16_t pixels;
|
||||
uint16_t pixelsleft;
|
||||
|
||||
switch(vs->rectstate) {
|
||||
case VNC_RECTSTATE_RAW:
|
||||
|
||||
if(vs->rectstateleft > datalen) {
|
||||
pixels = datalen;
|
||||
vs->rectstateleft -= datalen;
|
||||
} else {
|
||||
pixels = vs->rectstateleft;
|
||||
datalen = datalen - vs->rectstateleft;
|
||||
vs->rectstateleft = 0;
|
||||
vs->rectstate = VNC_RECTSTATE_NONE;
|
||||
vs->sendmsg = VNC_SEND_NONE;
|
||||
vs->waitmsg = VNC_WAIT_NONE;
|
||||
vnc_viewer_refresh();
|
||||
}
|
||||
|
||||
|
||||
pixelsleft = pixels;
|
||||
while(pixelsleft > 0) {
|
||||
if(pixelsleft >= vs->rectstatex2 - vs->rectstatex) {
|
||||
vnc_draw_pixelline(vs->rectstatex, vs->rectstatey,
|
||||
dataptr,
|
||||
vs->rectstatex2 - vs->rectstatex);
|
||||
dataptr += vs->rectstatex2 - vs->rectstatex;
|
||||
pixelsleft -= vs->rectstatex2 - vs->rectstatex;
|
||||
vs->rectstatex = vs->rectstatex0;
|
||||
++vs->rectstatey;
|
||||
vnc_viewer_refresh();
|
||||
} else {
|
||||
vnc_draw_pixelline(vs->rectstatex, vs->rectstatey,
|
||||
dataptr,
|
||||
pixelsleft);
|
||||
vs->rectstatex += pixelsleft;
|
||||
pixelsleft = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case VNC_RECTSTATE_RRE:
|
||||
break;
|
||||
}
|
||||
return pixels;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Returns: the amount of bytes that needs to be buffered before the
|
||||
rect can be drawn. */
|
||||
static unsigned short
|
||||
recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
||||
uint16_t dataleft)
|
||||
{
|
||||
struct rfb_rre_hdr *rrehdr;
|
||||
|
||||
|
||||
if((rhdr->encoding[0] |
|
||||
rhdr->encoding[1] |
|
||||
rhdr->encoding[2]) == 0) {
|
||||
switch(rhdr->encoding[3]) {
|
||||
case RFB_ENC_RAW:
|
||||
vs->rectstateleft = (uint32_t)uip_htons(rhdr->rect.w) * (uint32_t)uip_htons(rhdr->rect.h);
|
||||
vs->rectstate = VNC_RECTSTATE_RAW;
|
||||
vs->rectstatex0 = vs->rectstatex = uip_htons(rhdr->rect.x);
|
||||
vs->rectstatey0 = vs->rectstatey = uip_htons(rhdr->rect.y);
|
||||
vs->rectstatew = uip_htons(rhdr->rect.w);
|
||||
vs->rectstateh = uip_htons(rhdr->rect.h);
|
||||
vs->rectstatex2 = vs->rectstatex0 + vs->rectstatew;
|
||||
vs->rectstatey2 = vs->rectstatey0 + vs->rectstateh;
|
||||
break;
|
||||
|
||||
case RFB_ENC_RRE:
|
||||
rrehdr = (struct rfb_rre_hdr *)((uint8_t *)rhdr +
|
||||
sizeof(struct rfb_fb_update_rect_hdr));
|
||||
PRINTF(("Received RRE subrects %d (%d)\n",
|
||||
(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||
uip_htons(rrehdr->subrects[0]),
|
||||
rrehdr->bgpixel));
|
||||
vs->rectstateleft = ((uint32_t)(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||
(uint32_t)uip_htons(rrehdr->subrects[0]));
|
||||
vs->rectstate = VNC_RECTSTATE_RRE;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
PRINTF(("Bad encoding %02x%02x%02x%02x\n", rhdr->encoding[0],
|
||||
rhdr->encoding[1],rhdr->encoding[2],rhdr->encoding[3]));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
PRINTF(("recv_update_rect: returning%d\n", vs->rectstateleft));
|
||||
return sizeof(struct rfb_fb_update_rect_hdr) + vs->rectstateleft;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* identify_data():
|
||||
*
|
||||
* This function looks at the state of the connection (i.e., if it is
|
||||
* handshaking or in steady-state) as well as on the contents of the
|
||||
* incoming message and returns the number of bytes of data that is to
|
||||
* be expected.
|
||||
*/
|
||||
static uint16_t
|
||||
identify_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen)
|
||||
{
|
||||
switch(vs->waitmsg) {
|
||||
case VNC_WAIT_VERSION:
|
||||
/* Expecting version string (12 bytes). */
|
||||
return 12;
|
||||
break;
|
||||
case VNC_WAIT_AUTH:
|
||||
return 4;
|
||||
break;
|
||||
case VNC_WAIT_AUTH_RESPONSE:
|
||||
return 1;
|
||||
break;
|
||||
case VNC_WAIT_SINIT:
|
||||
/* XXX: We should check that the entire message header is
|
||||
received, otherwise we should buffer it. */
|
||||
return sizeof(struct rfb_server_init) +
|
||||
((struct rfb_server_init *)uip_appdata)->namelength[3] +
|
||||
((struct rfb_server_init *)uip_appdata)->namelength[2];
|
||||
|
||||
case VNC_WAIT_UPDATE:
|
||||
case VNC_WAIT_NONE:
|
||||
switch(*data) {
|
||||
case RFB_FB_UPDATE:
|
||||
PRINTF(("RFB FB UPDATE received\n"));
|
||||
return sizeof(struct rfb_fb_update);
|
||||
|
||||
case RFB_BELL:
|
||||
return 1;
|
||||
|
||||
case RFB_SERVER_CUT_TEXT:
|
||||
PRINTF(("Cut text received, unhandled\n"));
|
||||
return 8 + (data[6] << 8) + data[7];
|
||||
|
||||
case RFB_SET_COLORMAP_ENTRIES:
|
||||
uip_abort();
|
||||
PRINTF(("Set colormap entries received, unhandled\n"));
|
||||
return 0;
|
||||
|
||||
default:
|
||||
uip_abort();
|
||||
PRINTF(("Weird message type received (%d)\n", *(uint8_t *)uip_appdata));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case VNC_WAIT_UPDATE_RECT:
|
||||
return sizeof(struct rfb_fb_update_rect_hdr);
|
||||
|
||||
default:
|
||||
PRINTF(("identify: bad waitmsg %d\n", vs->waitmsg));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* handle_data():
|
||||
*
|
||||
* Handles the data.
|
||||
*/
|
||||
static unsigned short
|
||||
handle_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen)
|
||||
{
|
||||
|
||||
switch(vs->waitmsg) {
|
||||
case VNC_WAIT_VERSION:
|
||||
/* Make sure we get the right version string from the server. */
|
||||
/* XXX: not implemented. */
|
||||
PRINTF(("Got version, waiting for auth, sending version\n"));
|
||||
vs->waitmsg = VNC_WAIT_AUTH;
|
||||
vs->sendmsg = VNC_SEND_VERSION;
|
||||
break;
|
||||
case VNC_WAIT_AUTH:
|
||||
switch(data[3]) {
|
||||
case RFB_AUTH_FAILED:
|
||||
PRINTF(("Connection failed.\n"));
|
||||
uip_abort();
|
||||
return 0;
|
||||
|
||||
case RFB_AUTH_NONE:
|
||||
vs->sendmsg = VNC_SEND_CINIT;
|
||||
vs->waitmsg = VNC_WAIT_SINIT;
|
||||
PRINTF(("No authentication needed.\n"));
|
||||
break;
|
||||
case RFB_AUTH_VNC:
|
||||
vs->sendmsg = VNC_SEND_AUTH;
|
||||
vs->waitmsg = VNC_WAIT_AUTH_RESPONSE;
|
||||
PRINTF(("VNC authentication needed.\n"));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VNC_WAIT_SINIT:
|
||||
/* PRINTF(("Server init: w %d h %d, bps %d, d %d, name '%s'\n",
|
||||
uip_htons(((struct rfb_server_init *)data)->width),
|
||||
uip_htons(((struct rfb_server_init *)data)->height),
|
||||
((struct rfb_server_init *)data)->format.bps,
|
||||
((struct rfb_server_init *)data)->format.depth,
|
||||
((uint8_t *)data + sizeof(struct rfb_server_init))));*/
|
||||
vs->w = uip_htons(((struct rfb_server_init *)data)->width);
|
||||
vs->h = uip_htons(((struct rfb_server_init *)data)->height);
|
||||
vs->sendmsg = VNC_SEND_PFMT;
|
||||
vs->waitmsg = VNC_WAIT_NONE;
|
||||
break;
|
||||
|
||||
case VNC_WAIT_UPDATE:
|
||||
case VNC_WAIT_NONE:
|
||||
switch(*data) {
|
||||
case RFB_FB_UPDATE:
|
||||
vs->waitmsg = VNC_WAIT_UPDATE_RECT;
|
||||
vs->rectsleft = uip_htons(((struct rfb_fb_update *)data)->rects);
|
||||
PRINTF(("Handling RFB FB UPDATE for %d rects\n", vs->rectsleft));
|
||||
break;
|
||||
|
||||
case RFB_BELL:
|
||||
PRINTF(("BELL\n"));
|
||||
break;
|
||||
|
||||
case RFB_SERVER_CUT_TEXT:
|
||||
PRINTF(("Cut text received, unhandled\n"));
|
||||
break;
|
||||
|
||||
case RFB_SET_COLORMAP_ENTRIES:
|
||||
PRINTF(("Set colormap entries received, unhandled\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
PRINTF(("Weird message type received (%d)\n", *(uint8_t *)data));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VNC_WAIT_UPDATE_RECT:
|
||||
PRINTF(("Handling data in WAIT_UPDATE_RECT, %d rects left (%d bytes)\n", vs->rectsleft, datalen));
|
||||
--vs->rectsleft;
|
||||
if(vs->rectsleft > 0) {
|
||||
vs->waitmsg = VNC_WAIT_UPDATE_RECT;
|
||||
} else {
|
||||
vs->waitmsg = VNC_WAIT_NONE;
|
||||
vs->sendmsg = VNC_SEND_NONE;
|
||||
vs->rectstate = VNC_RECTSTATE_NONE;
|
||||
}
|
||||
return recv_update_rect((struct rfb_fb_update_rect_hdr *)data, datalen);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* newdata():
|
||||
*
|
||||
* Called whenever new data arrives.
|
||||
*
|
||||
* First, checks if data needs to be buffered before a previously
|
||||
* identified request can be fulfilled. If so, the incoming data is
|
||||
* buffered and the data handler is called. If no data needs to be
|
||||
* buffered, the code proceeds to identify the incoming request. If
|
||||
* the incoming request can be processed immediately (i.e., all data
|
||||
* is contained in this message) the data handler is invoked. If data
|
||||
* has to be buffered to fulfill the request, this is noted and taken
|
||||
* care of the next time this function is invoked (i.e., for the next
|
||||
* incoming data chunk).
|
||||
*/
|
||||
static uint8_t
|
||||
newdata(void)
|
||||
{
|
||||
uint16_t datalen;
|
||||
uint16_t readlen;
|
||||
uint8_t *dataptr;
|
||||
|
||||
datalen = uip_datalen();
|
||||
dataptr = (uint8_t *)uip_appdata;
|
||||
|
||||
PRINTF(("newdata: %d bytes\n", datalen));
|
||||
|
||||
/* If we are in a "rectstate", meaning that the incoming data is
|
||||
part of a rectangle that is being incrementaly drawn on the
|
||||
screen, we handle that first. */
|
||||
if(vs->rectstate != VNC_RECTSTATE_NONE) {
|
||||
readlen = recv_rectstate(dataptr, datalen);
|
||||
PRINTF(("newdata: vs->rectstate %d, datalen %d, readlen %d\n",
|
||||
vs->rectstate, datalen, readlen));
|
||||
datalen -= readlen;
|
||||
dataptr += readlen;
|
||||
}
|
||||
|
||||
/* Next, check if we are supposed to buffer data from the incoming
|
||||
segment. */
|
||||
while(vs->bufferleft > 0 && datalen > 0) {
|
||||
if(datalen >= vs->bufferleft) {
|
||||
/* There is more data in the incoming chunk than we need to
|
||||
buffer, so we buffer as much as we can and handle the
|
||||
buffered data, and repeat the (identify->buffer->handle)
|
||||
sequence for the data that is left in the incoming chunk. */
|
||||
datalen -= vs->bufferleft;
|
||||
dataptr += vs->bufferleft;
|
||||
buffer_data((uint8_t *)uip_appdata, vs->bufferleft);
|
||||
handle_data(vs->buffer, vs->buffersize);
|
||||
clearbuffer();
|
||||
} else { /* datalen < vs->bufferleft */
|
||||
/* We need to buffer more data than was received with this
|
||||
chunk, so we buffer the avaliable data and return. */
|
||||
buffer_data(dataptr, datalen);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, if there is data left in the segment, we handle it. */
|
||||
while(datalen > 0) {
|
||||
|
||||
if(vs->rectstate != VNC_RECTSTATE_NONE) {
|
||||
readlen = recv_rectstate(dataptr, datalen);
|
||||
PRINTF(("newdata (2): vs->rectstate %d, datalen %d, readlen %d\n",
|
||||
vs->rectstate, datalen, readlen));
|
||||
datalen -= readlen;
|
||||
dataptr += readlen;
|
||||
} else {
|
||||
|
||||
/* We get here if there is data to be identified in the incoming
|
||||
chunk. */
|
||||
readlen = identify_data(dataptr, datalen);
|
||||
|
||||
if(readlen == 0) {
|
||||
PRINTF(("Identify returned 0\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRINTF(("Reading %d bytes more\n", readlen));
|
||||
/* The data has been identified and the amount of data that
|
||||
needs to be read to be able to process the data is in the
|
||||
"readlen" variable. If the incoming chunk contains enough
|
||||
data, we handle it directly, otherwise we buffer the incoming
|
||||
data and set the state so that we know that there is more
|
||||
data to be buffered. */
|
||||
if(readlen > datalen) {
|
||||
clearbuffer(); /* Should not be needed, but just in case... */
|
||||
vs->bufferleft = readlen;
|
||||
buffer_data(dataptr, datalen);
|
||||
return 0;
|
||||
}
|
||||
if(readlen <= datalen) {
|
||||
PRINTF(("Before handle_data %d\n", readlen));
|
||||
readlen += handle_data(dataptr, readlen);
|
||||
PRINTF(("After handle_data %d\n", readlen));
|
||||
datalen -= readlen;
|
||||
dataptr += readlen;
|
||||
}
|
||||
|
||||
}
|
||||
if(datalen > 0) {
|
||||
PRINTF(("newdata: there is more data left after first iteration... %d\n", datalen));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Called when there is nothing else to do - checks for any pending
|
||||
events (mouse movements or keypresses). If no events are found, it
|
||||
makes sure that we send out an incremental update request. */
|
||||
static void
|
||||
check_events(void)
|
||||
{
|
||||
if(vs->sendmsg == VNC_SEND_NONE &&
|
||||
vs->eventptr_next != vs->eventptr_acked &&
|
||||
vs->eventptr_acked == vs->eventptr_unacked) {
|
||||
vs->sendmsg = VNC_SEND_EVENTS;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
request_update(void)
|
||||
{
|
||||
if(vs->sendmsg == VNC_SEND_NONE) {
|
||||
vs->sendmsg = VNC_SEND_UPDATERQ_INC;
|
||||
vs->waitmsg = VNC_WAIT_UPDATE;
|
||||
PRINTF(("request_update: requesting\n"));
|
||||
} else {
|
||||
PRINTF(("request_update: not requesting\n"));
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
acked(void)
|
||||
{
|
||||
switch(vs->sendmsg) {
|
||||
case VNC_SEND_PFMT:
|
||||
vs->sendmsg = VNC_SEND_ENCODINGS;
|
||||
break;
|
||||
case VNC_SEND_ENCODINGS:
|
||||
vs->sendmsg = VNC_SEND_UPDATERQ;
|
||||
vs->waitmsg = VNC_WAIT_UPDATE;
|
||||
clearbuffer();
|
||||
break;
|
||||
case VNC_SEND_EVENTS:
|
||||
vs->eventptr_acked = vs->eventptr_unacked;
|
||||
vs->sendmsg = VNC_SEND_NONE;
|
||||
check_events();
|
||||
break;
|
||||
default:
|
||||
vs->sendmsg = VNC_SEND_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_appcall(void * nullptr)
|
||||
{
|
||||
if(vs->close == 1) {
|
||||
uip_close();
|
||||
return;
|
||||
}
|
||||
|
||||
if(uip_connected()) {
|
||||
vs->sendmsg = VNC_SEND_NONE;
|
||||
vs->waitmsg = VNC_WAIT_VERSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if(uip_acked()) {
|
||||
acked();
|
||||
}
|
||||
|
||||
if(uip_newdata()) {
|
||||
newdata();
|
||||
}
|
||||
|
||||
if(vs->sendmsg == VNC_SEND_NONE &&
|
||||
vs->waitmsg == VNC_WAIT_NONE &&
|
||||
vs->rectstate == VNC_RECTSTATE_NONE) {
|
||||
check_events();
|
||||
request_update();
|
||||
}
|
||||
PRINTF(("vs->sendmsg %d, vs->waitmsg %d, vs->rectstate %d\n",
|
||||
vs->sendmsg, vs->waitmsg, vs->rectstate));
|
||||
|
||||
if(uip_rexmit() ||
|
||||
uip_newdata() ||
|
||||
uip_acked()) {
|
||||
senddata();
|
||||
} else if(uip_poll()) {
|
||||
check_events();
|
||||
senddata();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_post_event(uint8_t type,
|
||||
uint16_t data1, uint16_t data2,
|
||||
uint16_t data3, uint16_t data4)
|
||||
{
|
||||
register struct vnc_event *ev;
|
||||
struct vnc_event *ev0;
|
||||
|
||||
ev0 = &(vs->event_queue[(vs->eventptr_next - 1) % VNC_EVENTQUEUE_SIZE]);
|
||||
|
||||
ev = &(vs->event_queue[vs->eventptr_next]);
|
||||
switch(type) {
|
||||
case VNC_POINTER_EVENT:
|
||||
if(0 && vs->eventptr_next != vs->eventptr_acked &&
|
||||
ev0->type == VNC_POINTER_EVENT &&
|
||||
data1 == ev0->ev.ptr.buttonmask) {
|
||||
ev0->ev.ptr.x = data2;
|
||||
ev0->ev.ptr.y = data3;
|
||||
return;
|
||||
} else {
|
||||
ev->type = type;
|
||||
ev->ev.ptr.buttonmask = data1;
|
||||
ev->ev.ptr.x = data2;
|
||||
ev->ev.ptr.y = data3;
|
||||
}
|
||||
break;
|
||||
case VNC_KEY_EVENT:
|
||||
PRINTF(("Key event posted\n"));
|
||||
ev->type = type;
|
||||
ev->ev.key.down = data1;
|
||||
ev->ev.key.key = data2;
|
||||
break;
|
||||
case VNC_UPDATERQ_EVENT:
|
||||
PRINTF(("Update request event posted\n"));
|
||||
ev->type = type;
|
||||
ev->ev.urq.x = data1;
|
||||
ev->ev.urq.y = data2;
|
||||
ev->ev.urq.w = data3;
|
||||
ev->ev.urq.h = data4;
|
||||
break;
|
||||
}
|
||||
vs->eventptr_next = (vs->eventptr_next + 1) % VNC_EVENTQUEUE_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,326 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki VNC client.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __VNC_VIEWER_H__
|
||||
#define __VNC_VIEWER_H__
|
||||
|
||||
|
||||
struct vnc_viewer_state;
|
||||
|
||||
/*typedef unsigned long uint32_t;*/
|
||||
|
||||
void vnc_viewer_init(void);
|
||||
void vnc_viewer_appcall(void *nullptr);
|
||||
|
||||
void vnc_viewer_connect(uint16_t *server, uint8_t display);
|
||||
void vnc_viewer_close(void);
|
||||
|
||||
/* Callback: redraws the VNC viewer bitmap area. */
|
||||
void vnc_viewer_refresh(void);
|
||||
|
||||
#define VNC_POINTER_EVENT RFB_POINTER_EVENT
|
||||
#define VNC_KEY_EVENT RFB_KEY_EVENT
|
||||
#define VNC_UPDATERQ_EVENT 7
|
||||
|
||||
#define VNC_VIEWER_POST_POINTER_EVENT(x, y, button) \
|
||||
vnc_viewer_post_event(VNC_POINTER_EVENT, button, x, y, 0)
|
||||
|
||||
#define VNC_VIEWER_POST_KEY_EVENT(key) \
|
||||
vnc_viewer_post_event(VNC_KEY_EVENT, key, 0, 0, 0)
|
||||
|
||||
#define VNC_VIEWER_POST_UPDATERQ_EVENT(x1,y1,x2,y2) \
|
||||
vnc_viewer_post_event(VNC_UPDATERQ_EVENT, x1, y1, x2, y2)
|
||||
|
||||
void vnc_viewer_post_event(uint8_t event,
|
||||
uint16_t data1, uint16_t data2,
|
||||
uint16_t data3, uint16_t data4);
|
||||
|
||||
/* UIP_APPCALL: the name of the application function. This function
|
||||
must return void and take no arguments (i.e., C type "void
|
||||
appfunc(void)"). */
|
||||
#ifndef UIP_APPCALL
|
||||
#define UIP_APPCALL vnc_viewer_app
|
||||
#endif
|
||||
|
||||
struct vnc_key_event {
|
||||
uint8_t down;
|
||||
uint16_t key;
|
||||
};
|
||||
|
||||
struct vnc_pointer_event {
|
||||
uint8_t buttonmask;
|
||||
uint16_t x, y;
|
||||
};
|
||||
|
||||
struct vnc_updaterq_event {
|
||||
uint16_t x, y;
|
||||
uint16_t w, h;
|
||||
};
|
||||
|
||||
struct vnc_event {
|
||||
uint8_t type;
|
||||
union {
|
||||
struct vnc_key_event key;
|
||||
struct vnc_pointer_event ptr;
|
||||
struct vnc_updaterq_event urq;
|
||||
} ev;
|
||||
};
|
||||
|
||||
enum vnc_sendmsg {
|
||||
VNC_SEND_NONE,
|
||||
|
||||
VNC_SEND_VERSION,
|
||||
VNC_SEND_AUTH,
|
||||
VNC_SEND_CINIT,
|
||||
VNC_SEND_PFMT,
|
||||
VNC_SEND_ENCODINGS,
|
||||
|
||||
VNC_SEND_UPDATERQ,
|
||||
VNC_SEND_UPDATERQ_INC,
|
||||
VNC_SEND_EVENTS,
|
||||
};
|
||||
|
||||
enum vnc_waitmsg {
|
||||
VNC_WAIT_NONE,
|
||||
|
||||
VNC_WAIT_VERSION,
|
||||
VNC_WAIT_AUTH,
|
||||
VNC_WAIT_AUTH_RESPONSE,
|
||||
VNC_WAIT_SINIT,
|
||||
|
||||
VNC_WAIT_UPDATE,
|
||||
VNC_WAIT_UPDATE_RECT,
|
||||
|
||||
};
|
||||
|
||||
|
||||
enum vnc_rectstate {
|
||||
VNC_RECTSTATE_NONE,
|
||||
VNC_RECTSTATE_RAW,
|
||||
VNC_RECTSTATE_RRE,
|
||||
};
|
||||
|
||||
struct vnc_viewer_state {
|
||||
uint8_t close;
|
||||
uint16_t w, h;
|
||||
|
||||
uint8_t sendmsg;
|
||||
|
||||
uint8_t waitmsg;
|
||||
|
||||
uint16_t rectsleft;
|
||||
|
||||
uint8_t rectstate;
|
||||
uint32_t rectstateleft;
|
||||
uint16_t rectstatex, rectstatey;
|
||||
uint16_t rectstateh, rectstatew;
|
||||
uint16_t rectstatex0, rectstatey0;
|
||||
uint16_t rectstatex2, rectstatey2;
|
||||
|
||||
|
||||
uint16_t eventptr_acked;
|
||||
uint16_t eventptr_unacked;
|
||||
uint16_t eventptr_next;
|
||||
#define VNC_EVENTQUEUE_SIZE 32
|
||||
struct vnc_event event_queue[VNC_EVENTQUEUE_SIZE];
|
||||
|
||||
|
||||
uint16_t bufferleft;
|
||||
uint16_t buffersize;
|
||||
#define VNC_BUFFERSIZE 64
|
||||
uint8_t buffer[VNC_BUFFERSIZE];
|
||||
};
|
||||
|
||||
extern static struct vnc_viewer_state vnc_viewer_state;
|
||||
|
||||
/* Definitions of the RFB (Remote Frame Buffer) protocol
|
||||
structures and constants. */
|
||||
|
||||
#include "net/uipopt.h"
|
||||
|
||||
|
||||
/* Generic rectangle - x, y coordinates, width and height. */
|
||||
struct rfb_rect {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
};
|
||||
|
||||
/* Pixel format definition. */
|
||||
struct rfb_pixel_format {
|
||||
uint8_t bps; /* Bits per pixel: 8, 16 or 32. */
|
||||
uint8_t depth; /* Color depth: 8-32 */
|
||||
uint8_t endian; /* 1 - big endian (motorola), 0 - little endian
|
||||
(x86) */
|
||||
uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */
|
||||
|
||||
/* The following fields are only used if true color is used. */
|
||||
uint16_t red_max, green_max, blue_max;
|
||||
uint8_t red_shift, green_shift, blue_shift;
|
||||
uint8_t pad1;
|
||||
uint16_t pad2;
|
||||
};
|
||||
|
||||
|
||||
/* RFB authentication constants. */
|
||||
|
||||
#define RFB_AUTH_FAILED 0
|
||||
#define RFB_AUTH_NONE 1
|
||||
#define RFB_AUTH_VNC 2
|
||||
|
||||
#define RFB_VNC_AUTH_OK 0
|
||||
#define RFB_VNC_AUTH_FAILED 1
|
||||
#define RFB_VNC_AUTH_TOOMANY 2
|
||||
|
||||
/* RFB message types. */
|
||||
|
||||
/* From server to client: */
|
||||
#define RFB_FB_UPDATE 0
|
||||
#define RFB_SET_COLORMAP_ENTRIES 1
|
||||
#define RFB_BELL 2
|
||||
#define RFB_SERVER_CUT_TEXT 3
|
||||
|
||||
/* From client to server. */
|
||||
#define RFB_SET_PIXEL_FORMAT 0
|
||||
#define RFB_FIX_COLORMAP_ENTRIES 1
|
||||
#define RFB_SET_ENCODINGS 2
|
||||
#define RFB_FB_UPDATE_REQ 3
|
||||
#define RFB_KEY_EVENT 4
|
||||
#define RFB_POINTER_EVENT 5
|
||||
#define RFB_CLIENT_CUT_TEXT 6
|
||||
|
||||
/* Encoding types. */
|
||||
#define RFB_ENC_RAW 0
|
||||
#define RFB_ENC_COPYRECT 1
|
||||
#define RFB_ENC_RRE 2
|
||||
#define RFB_ENC_CORRE 3
|
||||
#define RFB_ENC_HEXTILE 4
|
||||
|
||||
/* Message definitions. */
|
||||
|
||||
/* Server to client messages. */
|
||||
|
||||
struct rfb_server_init {
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
struct rfb_pixel_format format;
|
||||
uint8_t namelength[4];
|
||||
/* Followed by name. */
|
||||
};
|
||||
|
||||
struct rfb_fb_update {
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr +
|
||||
data) that follows. */
|
||||
};
|
||||
|
||||
struct rfb_fb_update_rect_hdr {
|
||||
struct rfb_rect rect;
|
||||
uint8_t encoding[4];
|
||||
};
|
||||
|
||||
struct rfb_copy_rect {
|
||||
uint16_t srcx;
|
||||
uint16_t srcy;
|
||||
};
|
||||
|
||||
struct rfb_rre_hdr {
|
||||
uint16_t subrects[2]; /* Number of subrectangles (struct
|
||||
rfb_rre_subrect) to follow. */
|
||||
uint8_t bgpixel;
|
||||
};
|
||||
|
||||
struct rfb_rre_subrect {
|
||||
uint8_t pixel;
|
||||
struct rfb_rect rect;
|
||||
};
|
||||
|
||||
struct rfb_corre_rect {
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t w;
|
||||
uint8_t h;
|
||||
};
|
||||
|
||||
/* Client to server messages. */
|
||||
|
||||
struct rfb_set_pixel_format {
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t pad2;
|
||||
struct rfb_pixel_format format;
|
||||
};
|
||||
|
||||
struct rfb_fix_colormap_entries {
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t firstcolor;
|
||||
uint16_t colors;
|
||||
};
|
||||
|
||||
struct rfb_set_encodings {
|
||||
uint8_t type;
|
||||
uint8_t pad;
|
||||
uint16_t encodings;
|
||||
};
|
||||
|
||||
struct rfb_fb_update_request {
|
||||
uint8_t type;
|
||||
uint8_t incremental;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
};
|
||||
|
||||
struct rfb_key_event {
|
||||
uint8_t type;
|
||||
uint8_t down;
|
||||
uint16_t pad;
|
||||
uint8_t key[4];
|
||||
};
|
||||
|
||||
#define RFB_BUTTON_MASK1 1
|
||||
#define RFB_BUTTON_MASK2 2
|
||||
#define RFB_BUTTON_MASK3 4
|
||||
struct rfb_pointer_event {
|
||||
uint8_t type;
|
||||
uint8_t buttonmask;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
};
|
||||
|
||||
#endif /* __VNC_VIEWER_H__ */
|
234
apps/vnc/vnc.c
234
apps/vnc/vnc.c
|
@ -1,234 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki VNC client
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
/*#include "petsciiconv.h"*/
|
||||
#include "net/uiplib.h"
|
||||
#include "net/uip.h"
|
||||
#include "ctk/ctk.h"
|
||||
#include "ctk/ctk-mouse.h"
|
||||
#include "net/resolv.h"
|
||||
/*#include "telnet.h"*/
|
||||
#include "vnc.h"
|
||||
#include "vnc-draw.h"
|
||||
#include "vnc-viewer.h"
|
||||
#include "contiki-conf.h"
|
||||
|
||||
#include "sys/loader.h"
|
||||
|
||||
#if 1
|
||||
#define PRINTF(x)
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define PRINTF(x) printf x
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VNC_CONF_VIEWPORT_WIDTH
|
||||
#define VNC_VIEWPORT_WIDTH VNC_CONF_VIEWPORT_WIDTH
|
||||
#else
|
||||
#define VNC_VIEWPORT_WIDTH 10
|
||||
#endif
|
||||
|
||||
#ifdef VNC_CONF_VIEWPORT_HEIGHT
|
||||
#define VNC_VIEWPORT_HEIGHT VNC_CONF_VIEWPORT_HEIGHT
|
||||
#else
|
||||
#define VNC_VIEWPORT_HEIGHT 10
|
||||
#endif
|
||||
|
||||
#define HEIGHT (4 + VNC_VIEWPORT_HEIGHT/8)
|
||||
|
||||
/* Main window */
|
||||
static struct ctk_window mainwindow;
|
||||
|
||||
static char host[20];
|
||||
static struct ctk_textentry hosttextentry =
|
||||
{CTK_TEXTENTRY(0, 0, 18, 1, host, 18)};
|
||||
|
||||
static char portentry[4];
|
||||
static struct ctk_textentry porttextentry =
|
||||
{CTK_TEXTENTRY(21, 0, 3, 1, portentry, 3)};
|
||||
|
||||
static struct ctk_button connectbutton =
|
||||
{CTK_BUTTON(27, 0, 7, "Connect")};
|
||||
/*static struct ctk_button disconnectbutton =
|
||||
{CTK_BUTTON(25, 3, 10, "Disconnect")};*/
|
||||
|
||||
static struct ctk_separator sep1 =
|
||||
{CTK_SEPARATOR(0, 1, 36)};
|
||||
|
||||
static struct ctk_bitmap vncbitmap =
|
||||
{CTK_BITMAP(2, 2,
|
||||
VNC_VIEWPORT_WIDTH / 8,
|
||||
VNC_VIEWPORT_HEIGHT / 8,
|
||||
vnc_draw_bitmap,
|
||||
VNC_VIEWPORT_WIDTH,
|
||||
VNC_VIEWPORT_HEIGHT)};
|
||||
|
||||
static struct ctk_button leftbutton =
|
||||
{CTK_BUTTON(6, HEIGHT - 1, 4, "Left")};
|
||||
|
||||
static struct ctk_button upbutton =
|
||||
{CTK_BUTTON(13, HEIGHT - 1, 2, "Up")};
|
||||
|
||||
static struct ctk_button downbutton =
|
||||
{CTK_BUTTON(18, HEIGHT - 1, 4, "Down")};
|
||||
|
||||
static struct ctk_button rightbutton =
|
||||
{CTK_BUTTON(25, HEIGHT - 1, 5, "Right")};
|
||||
|
||||
PROCESS(vnc_process, "VNC viewer");
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
show(char *text)
|
||||
{
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
connect(void)
|
||||
{
|
||||
uip_ipaddr_t addr, *addrptr;
|
||||
uint16_t port;
|
||||
char *cptr;
|
||||
|
||||
/* Find the first space character in host and put a zero there
|
||||
to end the string. */
|
||||
for(cptr = host; *cptr != ' ' && *cptr != 0; ++cptr);
|
||||
*cptr = 0;
|
||||
|
||||
addrptr = &addr;
|
||||
if(uiplib_ipaddrconv(host, &addr) == 0) {
|
||||
if(resolv_lookup(host, &addrptr) == RESOLV_STATUS_UNCACHED) {
|
||||
resolv_query(host);
|
||||
show("Resolving host...");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
port = 0;
|
||||
for(cptr = portentry; *cptr != ' ' && *cptr != 0; ++cptr) {
|
||||
if(*cptr < '0' || *cptr > '9') {
|
||||
show("Port number error");
|
||||
return;
|
||||
}
|
||||
port = 10 * port + *cptr - '0';
|
||||
}
|
||||
|
||||
|
||||
vnc_viewer_connect(addrptr, port);
|
||||
|
||||
show("Connecting...");
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(vnc_process, ev, data)
|
||||
{
|
||||
unsigned short x, y;
|
||||
unsigned char xc, yc;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
ctk_window_new(&mainwindow, 36, HEIGHT, "VNC client");
|
||||
ctk_window_move(&mainwindow, 0, 0);
|
||||
|
||||
CTK_WIDGET_ADD(&mainwindow, &hosttextentry);
|
||||
CTK_WIDGET_FOCUS(&mainwindow, &hosttextentry);
|
||||
CTK_WIDGET_ADD(&mainwindow, &porttextentry);
|
||||
CTK_WIDGET_ADD(&mainwindow, &connectbutton);
|
||||
|
||||
CTK_WIDGET_ADD(&mainwindow, &sep1);
|
||||
|
||||
CTK_WIDGET_ADD(&mainwindow, &vncbitmap);
|
||||
|
||||
CTK_WIDGET_ADD(&mainwindow, &leftbutton);
|
||||
CTK_WIDGET_ADD(&mainwindow, &upbutton);
|
||||
CTK_WIDGET_ADD(&mainwindow, &downbutton);
|
||||
CTK_WIDGET_ADD(&mainwindow, &rightbutton);
|
||||
|
||||
vnc_draw_init();
|
||||
|
||||
ctk_window_open(&mainwindow);
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT();
|
||||
|
||||
if(ev == ctk_signal_button_activate) {
|
||||
if(data == (process_data_t)&connectbutton) {
|
||||
connect();
|
||||
}
|
||||
} else if(ev == ctk_signal_window_close) {
|
||||
process_exit(&vnc_process);
|
||||
LOADER_UNLOAD();
|
||||
} else if(ev == resolv_event_found) {
|
||||
if(strcmp(data, host) == 0) {
|
||||
if(resolv_lookup(host, NULL) == RESOLV_STATUS_CACHED) {
|
||||
connect();
|
||||
} else {
|
||||
show("Host not found");
|
||||
}
|
||||
}
|
||||
} else if(ev == ctk_signal_pointer_move) {
|
||||
/* Check if pointer is within the VNC viewer area */
|
||||
x = ctk_mouse_x();
|
||||
y = ctk_mouse_y();
|
||||
|
||||
xc = ctk_mouse_xtoc(x);
|
||||
yc = ctk_mouse_ytoc(y);
|
||||
|
||||
if(xc >= 2 && yc >= 2 &&
|
||||
xc < 2 + VNC_VIEWPORT_WIDTH / 8 &&
|
||||
yc < 2 + VNC_VIEWPORT_HEIGHT / 8) {
|
||||
|
||||
VNC_VIEWER_POST_POINTER_EVENT(x, y, 0);
|
||||
}
|
||||
|
||||
} else if(ev == tcpip_event) {
|
||||
vnc_viewer_appcall(data);
|
||||
}
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vnc_viewer_refresh(void)
|
||||
{
|
||||
CTK_WIDGET_REDRAW(&vncbitmap);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki VNC client.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __VNC_H__
|
||||
#define __VNC_H__
|
||||
|
||||
void vnc_init(char *arg);
|
||||
|
||||
#endif /* __VNC_H__ */
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __HTMLPARSER_H__
|
||||
#define __HTMLPARSER_H__
|
||||
#ifndef HTMLPARSER_H_
|
||||
#define HTMLPARSER_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -62,4 +62,4 @@ void htmlparser_init(void);
|
|||
void htmlparser_parse(char *data, uint16_t len);
|
||||
|
||||
|
||||
#endif /* __HTMLPARSER_H__ */
|
||||
#endif /* HTMLPARSER_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __WEBCLIENT_H__
|
||||
#define __WEBCLIENT_H__
|
||||
#ifndef WEBCLIENT_H_
|
||||
#define WEBCLIENT_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
#include "http-strings.h"
|
||||
|
@ -62,4 +62,4 @@ char *webclient_filename(void);
|
|||
char *webclient_hostname(void);
|
||||
unsigned short webclient_port(void);
|
||||
|
||||
#endif /* __WEBCLIENT_H__ */
|
||||
#endif /* WEBCLIENT_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __WWW_DSC_H__
|
||||
#define __WWW_DSC_H__
|
||||
#ifndef WWW_DSC_H_
|
||||
#define WWW_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(www_dsc);
|
||||
|
||||
#endif /* __WWW_DSC_H__ */
|
||||
#endif /* WWW_DSC_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __WWW_H__
|
||||
#define __WWW_H__
|
||||
#ifndef WWW_H_
|
||||
#define WWW_H_
|
||||
|
||||
#ifndef WWW_CONF_WEBPAGE_WIDTH
|
||||
#define WWW_CONF_WEBPAGE_WIDTH 80
|
||||
|
@ -64,4 +64,4 @@
|
|||
|
||||
PROCESS_NAME(www_process);
|
||||
|
||||
#endif /* __WWW_H__ */
|
||||
#endif /* WWW_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_CFS_H__
|
||||
#define __HTTPD_CFS_H__
|
||||
#ifndef HTTPD_CFS_H_
|
||||
#define HTTPD_CFS_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -58,4 +58,4 @@ struct httpd_state {
|
|||
void httpd_init(void);
|
||||
void httpd_appcall(void *state);
|
||||
|
||||
#endif /* __HTTPD_CFS_H__ */
|
||||
#endif /* HTTPD_CFS_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_CGI_H__
|
||||
#define __HTTPD_CGI_H__
|
||||
#ifndef HTTPD_CGI_H_
|
||||
#define HTTPD_CGI_H_
|
||||
|
||||
#include "contiki.h"
|
||||
#include "httpd.h"
|
||||
|
@ -53,4 +53,4 @@ void httpd_cgi_add(struct httpd_cgi_call *c);
|
|||
static struct httpd_cgi_call name = {NULL, str, function}
|
||||
|
||||
void httpd_cgi_init(void);
|
||||
#endif /* __HTTPD_CGI_H__ */
|
||||
#endif /* HTTPD_CGI_H_ */
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*/
|
||||
#ifndef __HTTPD_FS_H__
|
||||
#define __HTTPD_FS_H__
|
||||
#ifndef HTTPD_FS_H_
|
||||
#define HTTPD_FS_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
#include "httpd.h"
|
||||
|
@ -51,4 +51,4 @@ void* httpd_fs_get_root(void);
|
|||
|
||||
void httpd_fs_init(void);
|
||||
|
||||
#endif /* __HTTPD_FS_H__ */
|
||||
#endif /* HTTPD_FS_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __HTTPD_FSDATA_H__
|
||||
#define __HTTPD_FSDATA_H__
|
||||
#ifndef HTTPD_FSDATA_H_
|
||||
#define HTTPD_FSDATA_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -60,4 +60,4 @@ struct httpd_fsdata_file_noconst {
|
|||
#endif /* HTTPD_FS_STATISTICS */
|
||||
};
|
||||
|
||||
#endif /* __HTTPD_FSDATA_H__ */
|
||||
#endif /* HTTPD_FSDATA_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_H__
|
||||
#define __HTTPD_H__
|
||||
#ifndef HTTPD_H_
|
||||
#define HTTPD_H_
|
||||
/*
|
||||
* The default number of simultaneous server connections is 4. Multiple connections can be triggered
|
||||
* by requests for embedded images, style sheets, icons, etc. and a TCP RESET is issued when no more
|
||||
|
@ -328,4 +328,4 @@ char TCPBUF[512];
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* __HTTPD_H__ */
|
||||
#endif /* HTTPD_H_ */
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __URLCONV_H__
|
||||
#define __URLCONV_H__
|
||||
#ifndef URLCONV_H_
|
||||
#define URLCONV_H_
|
||||
|
||||
void urlconv_init(void);
|
||||
void urlconv_tofilename(char *dest, char *source, unsigned char maxlen);
|
||||
|
||||
#endif /* __URLCONV_H__ */
|
||||
#endif /* URLCONV_H_ */
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __WEBSERVER_DSC_H__
|
||||
#define __WEBSERVER_DSC_H__
|
||||
#ifndef WEBSERVER_DSC_H_
|
||||
#define WEBSERVER_DSC_H_
|
||||
|
||||
#include "sys/dsc.h"
|
||||
|
||||
DSC_HEADER(webserver_dsc);
|
||||
|
||||
#endif /* __WEBSERVER_DSC_H__ */
|
||||
#endif /* WEBSERVER_DSC_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __WEBSERVER_NOGUI_H__
|
||||
#define __WEBSERVER_NOGUI_H__
|
||||
#ifndef WEBSERVER_NOGUI_H_
|
||||
#define WEBSERVER_NOGUI_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -41,4 +41,4 @@ PROCESS_NAME(webserver_nogui_process);
|
|||
void webserver_log(char *msg);
|
||||
void webserver_log_file(uip_ipaddr_t *requester, char *file);
|
||||
|
||||
#endif /* __WEBSERVER_H__ */
|
||||
#endif /* WEBSERVER_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __WEBSERVER_H__
|
||||
#define __WEBSERVER_H__
|
||||
#ifndef WEBSERVER_H_
|
||||
#define WEBSERVER_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -41,4 +41,4 @@ PROCESS_NAME(webserver_process);
|
|||
void webserver_log(char *msg);
|
||||
void webserver_log_file(uip_ipaddr_t *requester, char *file);
|
||||
|
||||
#endif /* __WEBSERVER_H__ */
|
||||
#endif /* WEBSERVER_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_CFS_H__
|
||||
#define __HTTPD_CFS_H__
|
||||
#ifndef HTTPD_CFS_H_
|
||||
#define HTTPD_CFS_H_
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
|
@ -58,4 +58,4 @@ struct httpd_state {
|
|||
void httpd_init(void);
|
||||
void httpd_appcall(void *state);
|
||||
|
||||
#endif /* __HTTPD_CFS_H__ */
|
||||
#endif /* HTTPD_CFS_H_ */
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_CGI_H__
|
||||
#define __HTTPD_CGI_H__
|
||||
#ifndef HTTPD_CGI_H_
|
||||
#define HTTPD_CGI_H_
|
||||
|
||||
#include "contiki.h"
|
||||
#include "httpd.h"
|
||||
|
@ -53,4 +53,4 @@ void httpd_cgi_add(struct httpd_cgi_call *c);
|
|||
static struct httpd_cgi_call name = {NULL, str, function}
|
||||
|
||||
void httpd_cgi_init(void);
|
||||
#endif /* __HTTPD_CGI_H__ */
|
||||
#endif /* HTTPD_CGI_H_ */
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue