TEST ONLY!

Committer:
AjK
Date:
Wed Nov 17 19:39:33 2010 +0000
Revision:
0:a3d41f923207
TEST ONLY!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 0:a3d41f923207 1 /*
AjK 0:a3d41f923207 2 Copyright (c) 2010 Andy Kirkham
AjK 0:a3d41f923207 3
AjK 0:a3d41f923207 4 Permission is hereby granted, free of charge, to any person obtaining a copy
AjK 0:a3d41f923207 5 of this software and associated documentation files (the "Software"), to deal
AjK 0:a3d41f923207 6 in the Software without restriction, including without limitation the rights
AjK 0:a3d41f923207 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
AjK 0:a3d41f923207 8 copies of the Software, and to permit persons to whom the Software is
AjK 0:a3d41f923207 9 furnished to do so, subject to the following conditions:
AjK 0:a3d41f923207 10
AjK 0:a3d41f923207 11 The above copyright notice and this permission notice shall be included in
AjK 0:a3d41f923207 12 all copies or substantial portions of the Software.
AjK 0:a3d41f923207 13
AjK 0:a3d41f923207 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
AjK 0:a3d41f923207 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
AjK 0:a3d41f923207 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AjK 0:a3d41f923207 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AjK 0:a3d41f923207 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AjK 0:a3d41f923207 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
AjK 0:a3d41f923207 20 THE SOFTWARE.
AjK 0:a3d41f923207 21 */
AjK 0:a3d41f923207 22
AjK 0:a3d41f923207 23 #ifndef TLV_CUSTOM_H
AjK 0:a3d41f923207 24 #define TLV_CUSTOM_H
AjK 0:a3d41f923207 25
AjK 0:a3d41f923207 26 #include "tlv.h"
AjK 0:a3d41f923207 27
AjK 0:a3d41f923207 28 class tlv_custom_base {
AjK 0:a3d41f923207 29 public:
AjK 0:a3d41f923207 30 tlv_header header;
AjK 0:a3d41f923207 31 uint8_t oui[3];
AjK 0:a3d41f923207 32 uint8_t subtype;
AjK 0:a3d41f923207 33 tlv_custom_base () { header.setType(127); }
AjK 0:a3d41f923207 34 };
AjK 0:a3d41f923207 35
AjK 0:a3d41f923207 36 class tlv_custom {
AjK 0:a3d41f923207 37 public:
AjK 0:a3d41f923207 38 tlv_custom_base base;
AjK 0:a3d41f923207 39 tlv_payload payload;
AjK 0:a3d41f923207 40
AjK 0:a3d41f923207 41 void setOUI(char *s) { base.oui[0] = s[0]; base.oui[1] = s[1]; base.oui[2] = s[2]; }
AjK 0:a3d41f923207 42 void setSubtype(int subtype) { base.subtype = (uint8_t)(subtype & 0xFF); }
AjK 0:a3d41f923207 43 void setPayload(char *s, int len) { payload.pointer = s; payload.length = len; }
AjK 0:a3d41f923207 44 int copy (char *);
AjK 0:a3d41f923207 45 };
AjK 0:a3d41f923207 46
AjK 0:a3d41f923207 47 #endif