Commit graph

743 commits

Author SHA1 Message Date
Tommy Sparber 938d17576b doxygen: Fix many warnings
This commit fixes nearly all of the reported doxygen warnings.

I tried to not clutter the log with removed trailing spaces.
Removed whitespace and converted tab/spaces for all files affected by this commit
are in a separate branch.
2015-11-18 11:07:58 +11:00
Simon Duquennoy b5141f165c www.c: Explicitly declare itoa as it is non-standard and not necessarily in stdlib.h 2015-11-10 14:38:22 +01:00
Simon Duquennoy fbd78a7e3b Merge pull request #1293 from simonduq/pr/fix-warnings
Fix a number of compiler warnings and enable -Werror in Travis
2015-11-10 08:49:11 +01:00
Oliver Schmidt 8e9da827c0 Several minor adjustments. 2015-11-03 22:09:24 +01:00
Oliver Schmidt 0303944d0c Log web browser page attributes free memory left.
After page loading has finished the number of free bytes left for page attributes is logged. It turns out that "usual" pages tend to get along with ~800 bytes while i.e. the Google search pages use all of the 2000 bytes of page attribute memory allocated by default (because of the long URLs with many parameters). So it seems that reducing this default isn't exactly the best way to reduce memory consumption...
2015-11-01 21:22:19 +01:00
Oliver Schmidt 1639b712bb Removed CC_FASTCALL.
CC_FASTCALL was introduced many years ago for the cc65 tool chain. It was never used for another tool chain. With a798b1d648 the cc65 tool chain doesn't need CC_FASTCALL anymore.
2015-11-01 18:10:17 +01:00
Oliver Schmidt 1066bb1a0b Client requested close takes precedence over server initiated close.
When the client has already called webclient_close() it doesn't expect to have webclient_datahandler(NULL, 0) called just because the connection was closed by the server "at the same time". Rather it expects to always have webclient_closed() called.

Calling webclient_datahandler(NULL, 0) instead of webclient_closed() means that the web browser shows "Done" in the status line instead of "Stopped". So the user is mislead to think that he has already seen all of the page.

Note: webclient_close() is called by the client during newdata() so the already existing check for WEBCLIENT_STATE_CLOSE further above doesn't help.
2015-11-01 15:34:09 +01:00
Oliver Schmidt 185be73014 Just some minor optimizations. 2015-11-01 15:18:29 +01:00
Nicolas Tsiftes 566b251797 Merge pull request #1243 from unmole/coap_fix
CoAP: Fix handling of Token Length greater than 8
2015-10-23 17:58:15 +02:00
Simon Duquennoy 343326abee www.c: added #ifdef WITH_PETSCII guards to avoid compiler warning on unused variable wptr 2015-10-20 10:11:48 +02:00
Simon Duquennoy f49b161795 Remove commented-out code 2015-10-20 10:11:47 +02:00
Adam Dunkels 507309b0f5 Cast pointer to uintptr_t type to avoid compiler warnings 2015-10-20 10:11:40 +02:00
Adam Dunkels 160d792399 Cast pointer to uintptr_t type to avoid compiler warnings 2015-10-20 10:11:39 +02:00
Adam Dunkels bd54fe83f8 Cast pointer to uintptr_t type to avoid compiler warnings 2015-10-20 10:11:39 +02:00
Adam Dunkels c262eafe97 Fix compiler warnings 2015-10-20 10:11:30 +02:00
Adam Dunkels 08c6a69fe8 Fix compiler warnings 2015-10-20 10:11:29 +02:00
Adam Dunkels c0de05f9a8 Fix compiler warnings 2015-10-20 10:11:28 +02:00
Adam Dunkels 5e1ce413af Fix compiler warnings 2015-10-20 10:11:27 +02:00
Adam Dunkels 51233a7f88 Fix compiler warnings 2015-10-20 10:11:26 +02:00
Adam Dunkels 1ed9a20fdb Use unsigned long instead of uint32_t to avoid compiler warnings with the printfs 2015-10-20 10:11:25 +02:00
Simon Duquennoy 061c7d15c4 Powertrace: removed unused variables 2015-10-20 09:37:23 +02:00
Simon Duquennoy 10bd49a71a Merge pull request #756 from sieben/dos2unix
dos2unix fix
2015-10-18 20:26:07 +02:00
Niclas Finne d764e09f35 Make sure the url is null terminated in CoAP observe. 2015-09-24 22:51:30 +02:00
Niclas Finne 7edf6e60e9 Changed to use process API to switch process context in CoAP 2015-09-24 22:51:30 +02:00
Joakim Eriksson 539e92c084 Made rest-engine handle multiple init without dropping resources. 2015-09-24 22:51:30 +02:00
Joakim Eriksson 2351ee078a Fixed CoAP format to be a uint16_t since the enum might compile to 8 bit and cause problems if 16-bit format types are used 2015-09-24 22:51:30 +02:00
Joakim Eriksson 1b0cdee9ec Fixed observe to handle subresources and to always create a fake request for notify GETs 2015-09-24 22:51:30 +02:00
Niclas Finne ef9a36f9f6 Ensure parent resources match the path exactly and not as prefix. 2015-09-17 17:55:22 +02:00
Joakim Eriksson fe6d8685ac Fixed support for NULL attributes of resources 2015-09-11 00:52:45 +02:00
Joakim Eriksson 1e0b5292d7 Loop-unroll in CoAP for fixing some potential bugs on some platforms
where size_t is not the same as unsigned int.
2015-09-11 00:52:45 +02:00
Simon Duquennoy 63ddba93a9 Merge pull request #1169 from feshie/pr-warnings-fix
Fix multiple warnings (TCPIP, coap-observe, msp430, z1/tmp102, ContikiMAC)
2015-09-08 09:05:44 +02:00
Arthur Fabre 158087db62 Fix warning in coap-observe
../..//apps/er-coap/er-coap-observe.c:237:15: warning: unused variable
‘content’ [-Wunused-variable]
This was caused by a buffer that was declared, but used only in
commented out code.
The variable was moved to the commented out block.
The block was surrounded by an #if 0 ... #endif to make it easier to
uncomment.
Everything still compiles with the code in question uncommented.
2015-09-07 17:51:27 +01:00
Rémy Léone 7a5071dd30 Adding a gitattributes and correcting line-endings
https://help.github.com/articles/dealing-with-line-endings/
2015-09-07 15:40:02 +02:00
Anmol Sarma c084c46b9b Fix handling of Token Length greater than 8 2015-09-05 20:46:29 +05:30
Antonio Lignan 37470bbc1b Merge pull request #1055 from sumanpanchal/msp430x-elfloader
Added MSP430x ELFLOADER support to load image with large memory model.
2015-08-27 21:19:27 +02:00
Harald Pichler 500078ef9a update to contiki 3.0 2015-08-26 16:01:57 +02:00
Oliver Schmidt 902b21a326 Merge pull request #1188 from oliverschmidt/master
Some finishing touch on the CBM retro targets.
2015-08-08 16:33:59 +02:00
Oliver Schmidt 757809196e Some finishing touch on the CBM retro targets. 2015-08-08 15:41:24 +02:00
Arthur Fabre 5403b2a211 Fix default CoAP header block2 size
When a client sends a CoAP request with no block2 size,
the default one would be set to REST_MAX_CHUNK_SIZE.
However, this is not guaranteed to be a power of 2.
This can lead to clients receiving a bigger payload than expected as
part of the header, and ending up with duplicated content.
Setting the default to COAP_MAX_BLOCK_SIZE,
which is guaranteed to be a power of 2, fixes this.
2015-07-29 16:37:09 +01:00
Oliver Schmidt ab6d6498fe Added missing charset abstraction. 2015-07-16 17:55:26 +02:00
Oliver Schmidt a30e2e0045 Allow to configure Telnetd idle timeout.
The default Telnetd idle timeout of 30 seconds seems somewhat short. Best to have it user-configurable (incl. the option to turn it off with an config value of 0).
2015-07-06 12:25:20 +02:00
Oliver Schmidt a70fbf1bbf Reconfigured Telnet server.
In order to have the wget command make some sense the write command should be present too.
- On the Apple][ reduction of the MTU seems to gain just enough RAM to have the (rather heavy-weight) full-blown C library file I/O working.
- On the C128 there's way too little RAM so there's no wget command but only the file commands.
- On the CBMs a dummy lseek() was necessary to have the read command link.
2015-06-21 21:07:41 +02:00
Oliver Schmidt b8bece508a Fix DHCP client retries.
In order to have DHCP retries actually work dhcpc_appcall() must be called for PROCESS_EVENT_TIMER too.
2015-06-21 14:25:52 +02:00
Sumankumar Panchal db4df30366 Added MSP430X ELFLOADER support to load image with large memory model. 2015-06-15 17:53:18 +05:30
Oliver Schmidt c9edb9006b Merge pull request #1112 from oliverschmidt/master
Various improvements of the HTTP client and web browser.
2015-06-14 16:12:24 +02:00
Oliver Schmidt 3e33a4d355 Made server variant of HTTP strings a superset of the client variant again. 2015-06-08 14:29:34 +02:00
Oliver Schmidt 47bf797864 Added support for form with multiple submit buttons.
Forms with multiple submit buttons are rather rare but nevertheless the most popular web page (www.google.com) contains one with the two submit buttons "Google Search" and "I'm Feeling Lucky". So we want to support that - incl. the usual feature to the interpret first button as default button used when the user presses the ENTER key.
2015-06-07 00:29:29 +02:00
Oliver Schmidt e8b4befd1e Further improved parsing of <SCRIPT> tag.
Script code may contain a '<' as part of a equation. We erroneously interpreted that as start of a tag. Now we check for the very next char to be a '/' as the only tag allowed is the </SCRIPT> tag.
2015-06-07 00:23:44 +02:00
Oliver Schmidt 1d934db654 Reduce overlap on "scroll".
When using the 'down' button on a certain number of lines curently displayed at the bottom of the screen is redisplayed at the top of the screen. Given our usually small screen size and often large pages requiring many 'down' operations the number 'four' seems too generous so lets reduce it to 'two'.
2015-06-05 17:27:08 +02:00
Oliver Schmidt c5103bf997 Removed some redundant redrawing. 2015-06-05 16:59:16 +02:00
Oliver Schmidt f6b315a17f Fixed history handling.
- The wraparound handling when using the history with the 'back' button is actually depending on history_last being unsigned (which is the default for cc65) so define it explicitly as unsigned to make it work on other targets too.
- As there's no 'forward' button it doesn't make sense to keep history entries after using them with the 'back' button. Clearing them on use on the other hand avoids an "infinite history".
2015-06-05 16:34:57 +02:00
Oliver Schmidt e6903e4e7e Recognize HTTPS.
Although we for sure don't support HTTPS we need to recognize it. Nowadays it has become pretty usual to redirect HTTP URLs to HTTPS URLs in order to force privacy (thanks, NSA !). So far our redirection handler didn't recognize an HTTPS URL as abslute URLs and therefore appended it to the curent URL. This led to an endless redirection loop. Now we recognize the HTTPS redirection and generate a minimal document on the fly to inform the user of (for us unrachable) the redirection target.

HTML links with HTTPS URLs are treated just like fragment-only links meaning that they get simply completely ignored.
2015-06-05 16:26:20 +02:00
Oliver Schmidt 2f2295c182 Correctly initialize 'wordlen'. 2015-06-05 16:26:17 +02:00
Oliver Schmidt e93f9da7af Adjusted coding style. 2015-06-04 22:39:16 +02:00
Oliver Schmidt 448fa88ad8 Fixed handling of empty URLs.
The code to trim spaces from the end of the URL behaved undefined if the URL was empty. That scenario is far from hypothetic as i.e. pressing the 'back' button with no (more) entry in the history yields an empty URL.
2015-06-04 22:00:52 +02:00
Oliver Schmidt 8b0a7a697f Filter excessive newlines.
The way our HTML parser triggers newlines is a guess at best. On the other hand our screen estate is severely limited. Instead of trying to (further) improve the way we translate tags to newlines it seems more reasonable to simply never render more than two successive empty lines.
2015-06-04 21:14:37 +02:00
Oliver Schmidt cdd289a7ff Ignore fragment-only links.
We don't handle URLs with fragments exactly ;-) well - meaning we send the fragment part to the server and we don't display the document starting at the anchor tag. Instead of adding the missing capabilities and thus adding lots of code I instead opted to simply ignore fragment-only links. This approach is based on the practical knowledge that fragments are primarily used for intra-document navigation - and are as such fragment-only links. And as we ignore them anyway when displaying the document it's more ergonomic to not have those links in the first place.
2015-05-25 18:18:44 +02:00
Oliver Schmidt 9b9b92be06 Improved parsing of <SCRIPT> tag.
Complex script code tends to contain other tags inside strings. As we generally don't parse strings we erroneously interpreted those tags. The easiest workaround is to not interpret tags at all until the </SCRIPT> tag is found.
2015-05-25 16:46:23 +02:00
Oliver Schmidt a8837e230c Removed support for <FRAME> tag.
Framesets aren't used nowadays anymore so it seems reasonable to remove support for them in order to save some space.
2015-05-25 16:19:30 +02:00
Oliver Schmidt 980d055f72 Allow for attributes in <li> tags.
parse_tag() is called both for attributes inside a tag and the end of the tag itself. For most tags parse_tag() doesn't distinguish both cases. This means that the "tag action" is additionally triggered for every tag attribute. When the tag "action" is setting some state this doesn't hurt. For many tags the "tag action" is to render a newline. Superfluous newlines are sort of acceptable to keep the code as small as possible. However the <li> "tag action" is to render a newline followed by an asterisk - and superfluous asterisks are ugly so we check for <li> if parse_tag() was called for the end of the tag itself.
2015-05-24 19:40:35 +02:00
Oliver Schmidt a9f88a05d6 Don't render consecutive blanks inside links. 2015-05-24 19:00:39 +02:00
Oliver Schmidt a56af59f40 Avoid randomly "eating" blanks.
At the time do_word() is called s.word[s.wordlen] is undefined. So it doesn't make sense to make decisions based on its value - and in fact I don't see why it was necessary/desirable in the first place.
2015-05-24 15:45:45 +02:00
Harald Pichler 6a0d407806 Merge branch 'contiki' into osd 2015-05-19 10:54:55 +02:00
Adam Dunkels 730bda2001 Merge pull request #883 from cmorty/pull/global-macros
Move MAX, MIN and ABS to contiki-macros
2015-05-18 21:33:00 +02:00
Moritz 'Morty' Strübe 0dab6926b3 Move MAX, MIN and ABS to sys/cc.h 2015-05-18 08:53:17 +02:00
Harald Pichler 877bf27f5a Merge branch 'contiki' into osd 2015-05-15 20:48:26 +02:00
Brad Campbell 6eaada0c3f Delete old CoAP implementation
It seems that this implementation of CoAP in Contiki is no longer
maintained in favor of the `er-coap` implementation. This commit
removes the code to prevent confusion and further bit-rot.
2015-05-14 17:20:46 -04:00
Nicolas Tsiftes f7ca4b41a9 Merge pull request #1001 from adamdunkels/pr/queuebuf-no-ref
Cleanup: remove the obsolete reference packetbuf
2015-05-03 16:35:17 +02:00
Oliver Schmidt 40417a2bcd Skip HTTP header fields to long to parse.
Nowadays many HTTP server set cookies which may easily result in HTTP header fields longer than our 'httpheaderline' buffer. It doesn't hurt if we can't parse them but we need to be able to skip them and continue to parse the following header fields.
2015-05-02 00:11:59 +02:00
Oliver Schmidt 085b7d8898 Set WWW_CONF_MAX_URLLEN to maximum value by default.
WWW_CONF_MAX_URLLEN is used as length for the 'editurl' textentry widget. The CTK code for handling that widget uses a single byte so the length can't be > 255. Thus WWW_CONF_MAX_URLLEN can't be > 255 as well.
2015-04-29 18:21:35 +02:00
Adam Dunkels 7acf747c1a Removed packetbuf references. This was a feature that is not used anymore and only made the code more complex. 2015-04-01 21:33:02 +02:00
Nicolas Tsiftes 8f50d9709d Merge pull request #999 from adamdunkels/lebrush-rdnss-support-rebased
RDNSS support, again
2015-03-30 17:21:23 +02:00
Harald Pichler 560117e8f3 Merge branch 'contiki' into osd 2015-03-23 13:07:28 +01:00
Daniele Alessandrelli 799e9350a0 er-coap: add client-side support for CoAP Observe
Client-side support for CoAP observe is not compiled by default. To enable it, the COAP_OBSERVE_CLIENT macro must be defined equal to 1.
2015-02-24 22:46:48 +01:00
Harald Pichler d31ecbf486 Merge branch 'contiki' into osd 2015-02-18 10:04:47 +01:00
Jonas Olsson 1e92211613 Add MQTT 3.1 engine 2015-02-17 13:44:29 +01:00
George Oikonomou dd4f181cde Fix warnings caused by incorrect \defgroup, \addtogroup, \file 2015-02-15 20:11:09 +01:00
George Oikonomou 0b382a933a Fix warnings caused by unescaped special doxygen chars 2015-02-15 20:11:09 +01:00
Ralf Schlatterbeck 058ae7bae3 Alleged race-condition was a bug in receiver
Handling put-requests was missing a trailing \0 in the parsed string.
2015-01-27 10:43:03 +01:00
Ralf Schlatterbeck baaa2c5741 Factor/Fix generic resources
Now the old GENERIC_RESOURCE macros works again (but usage has changed).
Common resources (battery, leds, radio) are now in resources-common.
2015-01-21 15:41:21 +01:00
Víctor Ariño ccc0d27da0 Integrates uip-nameserver API
On the same commit the src have been uncrustified and some typo
fixes as well as includes missing.
2015-01-09 09:44:06 +01:00
Harald Pichler 9efc5d41c1 Merge branch 'contiki' into osd 2014-12-29 08:20:00 +01:00
Harald Pichler 365fe31b02 coap 18 2014-12-29 08:16:47 +01:00
Harald Pichler df95393980 remove init pwm per default, switch moisture sensor on and off to save energy 2014-12-12 08:47:01 +01:00
Harald Pichler a02be51f08 Merge branch 'contiki' into osd 2014-12-07 15:24:00 +01:00
Simon Duquennoy bd4233a953 Cleanup packetbuf: use rime attributes and addresses only when rime is enabled. Saves 32 byte per queuebuf in the non-rime case. 2014-12-02 16:54:58 +01:00
Simon Duquennoy 415506c3f6 Doxygen fixes 2014-12-02 12:39:16 +01:00
Simon Duquennoy a9cc909794 Network layer configuration: replace UIP_CONF_* with NETSTACK_CONF_WITH_* 2014-12-01 21:02:57 +01:00
Simon Duquennoy 722b3258d1 Cleanup of the Contiki network layer configuration. Now using CONTIKI_WITH_IPV6, CONTIKI_WITH_IPV4, and CONTIKI_WITH_RIME in makefiles, and UIP_CONF_IPV6, UIP_CONF_IPV4, UIP_CONF_RIME in c code. Now only the stacks that are used are compiled (via makefile MODULES). Make IPv6 the default network stack. 2014-12-01 20:13:09 +01:00
Ralf Schlatterbeck ef06560465 Use PROCESS_PAUSE macro 2014-11-19 13:54:07 +01:00
Ralf Schlatterbeck abdf6f8c6b Refactor A/D conversion in adc.c
Now the necessary settings are in adc.h. Refactored to allow repeated
ADC reads without reinitialization. Arduino allows setting
analogReference, this is now also implemented.
ADC is now initialized to sane values in apps/arduino/arduino-process.c
dev/arduino/arduino-compat.h now has all hardware independent settings
for arduino (some moved from platform/osd-merkur/dev/hw-arduino.h).
turnOffPWM re-implemented with hw_timer, removed from wiring_digital.c
ADC-specific arduino stuff moved to arduino-compat.h
Arduinos wiring_analog no longer necessary.
arduino-sketch example now reads analog inputs 1 and 5 using analogRead.
2014-11-19 13:53:32 +01:00
Ralf Schlatterbeck d5284eebe1 Factor resources, fix time
Now there is a generic resource that can generate and parse
application/json as well as text/plain. It can be re-used, only the
from_string and to_string routines have to be written and the resource
properly set up. A new resource format is specified, see
GENERIC_RESOURCE in, e.g., examples/osd/pwm-example. This is now used in
all my examples, namely pwm-example, arduino-sketch, wallclock-time.

There was an off by one error for the month in time formatting (in
gmtime and localtime). And the leap-year computation was broken. Both
fixed now, so we get a correct date. For localtime we are still 2 hours
off because daylight saving isn't implemented yet.

Also renamed gmtime to utc.
2014-11-19 13:53:12 +01:00
Ralf Schlatterbeck 4f20df042f Fix leap year computation 2014-11-19 13:53:01 +01:00
Ralf Schlatterbeck c46d6afa39 Make Arduino timer stuff work on Contiki
New discovery: Contiki also uses timer 0. With almost the same interface
as Arduino. So we now completely get rid of wiring.c (only the main
file, the other wiring_xxx stay) and implement Arduino timer, delay, etc
in terms of the corresponding Contiki routines. Verified that now delay
works as expected. The LED in examples/osd/arduino-sketch blinks!

Before this, the arduino_init routine in wiring.c destroyed the timer-0
initialization of contiki, making both, contiki timer implementation
*and* contiki timer implementation fail if the arduino_init routine was
called. Now both work.

Squashed with following bug-fix commit.
2014-11-19 13:50:58 +01:00
Ralf Schlatterbeck b6be226e69 Add Arduino compatibility layer
We can now directly compile arduino sketches (.pde) files.
Arduino compatible analogWrite works now.
But there is still a long way to go, serial I/O and timer stuff (delay,
millis etc) currently don't work (not tested but I don't expect this to
work).
It can be used in an arduino sketch or in a normal contiki program.
We get a PWM frequency of 490.2 Hz (a period of 2.040 ms), that's
Arduino compatible. If you need different frequencies see native timer
usage in examples/osd/pwm-example
In a contiki program you have to call arduino_pwm_timer_init to
initialize the timer before pwm works. The arduino sketch wrapper
already does this.
For running a sketch, see examples/osd/arduino-sketch
2014-11-19 13:48:05 +01:00
Ralf Schlatterbeck b4fb8c3f52 Add wallclock time handling
New application and new example.
We use the built-in timer routines and add an offset to get the
wallclock time. The offset can be set by time-changing routines
(currently only settimeofday).
We also maintain an offset for timezone handling but this isn't
currently fully implemented.
2014-11-19 13:43:45 +01:00
Enrico Joerns 85b494c16b [doc] Give files a common structure by placing license first (partial)
Followed by doxyen file and group tags.
This patch is only a first attempt to make provide a clean structure,
many more files require rework, too.
2014-11-10 23:54:49 +01:00
Enrico Joerns 9dd7f1d29a [doc] added faulty esb and msp430 references 2014-11-10 23:53:32 +01:00
Nicolas Tsiftes 7738cdd15e Avoid compilation warnings in Antelope. 2014-09-05 18:21:47 +02:00
Daniele Alessandrelli 21898f1e21 er-coap (observe): fix possible duplicate value for observe option in GET response and subsequent notification
Currently, the observe value for a response to a GET observe request is always set to zero. That may cause the subsequent notification to have the same observe value. In fact, that happens every time an observable resource is observed for the first time (since the obs_counter is implicitly initialized to zero).
This patch fixes such a problem by setting the observe option value of responses to obs_counter (and then incrementing it).
2014-08-24 19:07:36 +02:00