[riot-notifications] [RIOT] Initial TFTP support (#3911)

DipSwitch notifications at github.com
Mon Sep 21 14:05:55 CEST 2015


> +#include "net/gnrc/udp.h"
> +#include "net/gnrc/ipv6.h"
> +#include "random.h"
> +
> +#define ENABLE_DEBUG                (1)
> +#include "debug.h"
> +
> +#if ENABLE_DEBUG
> +/* For PRIu16 etc. */
> +#include <inttypes.h>
> +#endif
> +
> +#define ENABLE_TFTP_ERROR_SEND                 0
> +
> +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> +#define CT_HTONS(x)         ((          \

Because there are no "compile time" HTONS NTONS macro's. Which means that I couldn't define my enums like:

	typedef enum {
		TO_RRQ          = CT_HTONS(1),      /**< Read Request */
		TO_RWQ          = CT_HTONS(2),      /**< Write Request */
		TO_DATA         = CT_HTONS(3),      /**< Data */
		TO_ACK          = CT_HTONS(4),      /**< Acknowledgment */
		TO_ERROR        = CT_HTONS(5),      /**< Error */
		TO_OACK         = CT_HTONS(6),      /**< Option ACK */
	} tftp_opcodes_t;

And don't have to swap the error and op codes runtime time. I could change them to network_uint16_t's and use defines, but this is easier for debugging :)

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/3911/files#r39963171
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150921/5d9b4d60/attachment.html>


More information about the notifications mailing list