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_H
AjK 0:a3d41f923207 24 #define TLV_H
AjK 0:a3d41f923207 25
AjK 0:a3d41f923207 26 #ifndef MBED_H
AjK 0:a3d41f923207 27 #include "mbed.h"
AjK 0:a3d41f923207 28 #endif
AjK 0:a3d41f923207 29
AjK 0:a3d41f923207 30 class tlv_header {
AjK 0:a3d41f923207 31 public:
AjK 0:a3d41f923207 32 uint16_t typeLength;
AjK 0:a3d41f923207 33 tlv_header() { typeLength = 0; }
AjK 0:a3d41f923207 34 int copy (char *s);
AjK 0:a3d41f923207 35 void setType(int type) { typeLength |= ((type & 0x7F) << 9); }
AjK 0:a3d41f923207 36 int getType(void) { return (typeLength >> 9) & 0x7F; }
AjK 0:a3d41f923207 37 void setLength(int len) { typeLength |= (len & 0x1FF); }
AjK 0:a3d41f923207 38 int getLength(void) { return typeLength & 0x1FF; }
AjK 0:a3d41f923207 39 //void setType(int type) { typeLength |= (type & 0x7F); }
AjK 0:a3d41f923207 40 //int getType(void) { return typeLength & 0x7F; }
AjK 0:a3d41f923207 41 //void setLength(int len) { typeLength |= ((len & 0x1FF) << 7); }
AjK 0:a3d41f923207 42 //int getLength(void) { return (typeLength >> 7) & 0x1FF; }
AjK 0:a3d41f923207 43 };
AjK 0:a3d41f923207 44
AjK 0:a3d41f923207 45 class tlv_payload {
AjK 0:a3d41f923207 46 public:
AjK 0:a3d41f923207 47 char *pointer;
AjK 0:a3d41f923207 48 int length;
AjK 0:a3d41f923207 49 tlv_payload() { length = 0; pointer = NULL; }
AjK 0:a3d41f923207 50 };
AjK 0:a3d41f923207 51
AjK 0:a3d41f923207 52 #endif