libschc
Macros | Variables
rules_example.h File Reference
#include "schc_config.h"

Go to the source code of this file.

Macros

#define IPV6_RULES   3
 
#define UDP_RULES   3
 
#define COAP_RULES   4
 
#define DEVICE_COUNT   2
 

Variables

const static struct schc_ipv6_rule_t ipv6_rule1
 
const static struct schc_ipv6_rule_t ipv6_rule2
 
const static struct schc_ipv6_rule_t ipv6_rule3
 
const static struct schc_udp_rule_t udp_rule1
 
const static struct schc_udp_rule_t udp_rule2
 
const static struct schc_udp_rule_t udp_rule3
 
const static struct schc_coap_rule_t coap_rule1
 
const static struct schc_coap_rule_t coap_rule2
 
const static struct schc_coap_rule_t coap_rule3
 
const static struct schc_coap_rule_t coap_rule4
 
const struct schc_compression_rule_t compression_rule_1
 
const struct schc_compression_rule_t compression_rule_2
 
const struct schc_compression_rule_t compression_rule_3
 
const struct schc_compression_rule_t compression_rule_4
 
const struct schc_rule_t schc_rule_1 = { 0x01, &compression_rule_1, NOT_FRAGMENTED, 0, 0, 0, 0 }
 
const struct schc_rule_t schc_rule_2 = { 0x02, &compression_rule_1, NO_ACK, 1, 0, 0, 0 }
 
const struct schc_rule_t schc_rule_3 = { 0x03, &compression_rule_1, ACK_ON_ERROR, 3, 6, 1, 0 }
 
const struct schc_rule_t schc_rule_4 = { 0x04, &compression_rule_1, ACK_ALWAYS, 3, 6, 1, 0 }
 
const struct schc_rule_t schc_rule_5 = { 0x05, &compression_rule_2, NOT_FRAGMENTED, 0, 0, 0, 0 }
 
const struct schc_rule_t schc_rule_6 = { 0x06, &compression_rule_2, NO_ACK, 1, 0, 0, 0 }
 
const struct schc_rule_t schc_rule_7 = { 0x07, &compression_rule_2, ACK_ON_ERROR, 3, 6, 1, 0 }
 
const struct schc_rule_t schc_rule_8 = { 0x08, &compression_rule_2, ACK_ALWAYS, 3, 6, 1, 0 }
 
const struct schc_rule_tnode1_schc_rules []
 
const struct schc_device node1 = { 1, 8, &node1_schc_rules }
 
const struct schc_device node2 = { 2, 8, &node2_schc_rules}
 
const struct schc_devicedevices [DEVICE_COUNT] = { &node1, &node2 }
 

Macro Definition Documentation

◆ COAP_RULES

#define COAP_RULES   4

◆ DEVICE_COUNT

#define DEVICE_COUNT   2

◆ IPV6_RULES

#define IPV6_RULES   3

◆ UDP_RULES

#define UDP_RULES   3

Variable Documentation

◆ coap_rule1

const static struct schc_coap_rule_t coap_rule1
static
Initial value:
= {
1, 9, 7, 9,
{
{ "version", 0, 1, 1, BI, {COAP_V1}, &equal, NOTSENT },
{ "type", 0, 1, 1, BI, {CT_NON}, &equal, NOTSENT },
{ "token length", 0, 1, 1, BI, {4}, &equal, NOTSENT },
{ "code", 0, 1, 1, UP, {CC_PUT}, &equal, NOTSENT },
{ "message ID", 0, 2, 1, UP, {0x23, 0xBB}, &equal, NOTSENT },
{ "token", 24, 4, 1, BI, {0x21, 0xFA, 0x01, 0x00},
&MSB, LSB },
{ "uri-path", 0, 5, 1, BI, "usage", &equal, NOTSENT },
{ "no-response", 0, 1, 1, BI, {0x1A}, &equal, NOTSENT },
{ "payload marker", 0, 1, 1, BI, {255}, &equal, NOTSENT }
}
}

◆ coap_rule2

const static struct schc_coap_rule_t coap_rule2
static
Initial value:
= {
2, 8, 8, 10,
{
{ "version", 0, 1, 1, BI, {COAP_V1}, &equal, NOTSENT },
{ "type", 0, 3, 1, BI, {CT_CON, CT_ACK, CT_NON},
{ "token length", 0, 1, 1, BI, {4}, &equal, NOTSENT },
{ "code", 0, 1, 1, UP, {CC_CONTENT}, &equal, NOTSENT },
{ "code", 0, 1, 1, DOWN, {CC_GET}, &equal, NOTSENT },
{ "message ID", 12, 2, 1, UP, {0x23, 0xBB}, &MSB, LSB },
{ "message ID", 12, 2, 1, DOWN, {0x7A, 0x10}, &MSB, LSB },
{ "token", 0, 4, 1, BI, {0, 0, 0, 0}, &ignore, VALUESENT },
{ "uri-path", 0, 4, 2, BI, "[\"temp\",\"humi\",\"batt\",\"r\"]\0",
{ "payload marker", 0, 1, 1, BI, {255}, &equal, NOTSENT }
}
}

◆ coap_rule3

const static struct schc_coap_rule_t coap_rule3
static
Initial value:
= {
3, 8, 6, 8,
{
{ "version", 0, 1, 1, BI, {COAP_V1}, &equal, NOTSENT },
{ "type", 0, 1, 1, BI, {CT_NON}, &equal, NOTSENT },
{ "token length", 0, 1, 1, BI, {4}, &equal, NOTSENT },
{ "code", 0, 1, 1, UP, {CC_PUT}, &equal, NOTSENT },
{ "message ID", 0, 2, 1, UP, {0x23, 0xBB}, &equal, NOTSENT },
{ "token", 24, 4, 1, BI, {0x21, 0xFA, 0x01, 0x00},
&MSB, LSB },
{ "uri-path", 0, 5, 1, BI, "usage", &equal, NOTSENT },
{ "no-response", 0, 1, 1, BI, {0x1A}, &equal, NOTSENT }
}
}

◆ coap_rule4

const static struct schc_coap_rule_t coap_rule4
static
Initial value:
= {
4, 12, 12, 12,
{
{ "version", 0, 1, 1, BI, {COAP_V1}, &equal, NOTSENT },
{ "type", 0, 1, 1, BI, {CT_CON}, &equal, NOTSENT },
{ "token length", 0, 1, 1, BI, {8}, &equal, NOTSENT },
{ "code", 0, 1, 1, BI, {CC_POST}, &equal, NOTSENT },
{ "message ID", 0, 2, 1, BI, {0x23, 0xBB}, &ignore, VALUESENT },
{ "token", 24, 8, 1, BI, {0x21, 0xFA, 0x01, 0x00},
{ "uri-path", 0, 2, 1, BI, "rd", &equal, NOTSENT },
{ "content-format", 0, 1, 1, BI, {0x28}, &equal, NOTSENT },
{ "uri-query", 0, 9, 1, BI, {0x6C, 0x77, 0x6D, 0x32, 0x6D, 0x3D, 0x31, 0x2E, 0x30},
{ "uri-query", 0, 11, 1, BI, {0x65, 0x70, 0x3D, 0x6D, 0x61, 0x67, 0x69, 0x63, 0x69, 0x61, 0x6E},
{ "uri-query", 0, 6, 1, BI, {0x6C, 0x74, 0x3D, 0x31, 0x32, 0x31},
{ "payload marker", 0, 1, 1, BI, {255}, &equal, NOTSENT }
}
}

◆ compression_rule_1

const struct schc_compression_rule_t compression_rule_1
Initial value:

◆ compression_rule_2

const struct schc_compression_rule_t compression_rule_2
Initial value:

◆ compression_rule_3

const struct schc_compression_rule_t compression_rule_3
Initial value:

◆ compression_rule_4

const struct schc_compression_rule_t compression_rule_4
Initial value:

◆ devices

const struct schc_device* devices[DEVICE_COUNT] = { &node1, &node2 }

◆ ipv6_rule1

const static struct schc_ipv6_rule_t ipv6_rule1
static
Initial value:
= {
1, 10, 10, 10,
{
{ "version", 0, 1, 1, BI, {6}, &equal, NOTSENT },
{ "traffic class", 0, 1, 1, BI, {0}, &ignore, NOTSENT },
{ "flow label", 0, 3, 1, BI, {0, 0, 0}, &ignore, NOTSENT },
{ "length", 0, 2, 1, BI, {0, 0}, &ignore, COMPLENGTH },
{ "next header", 0, 1, 1, BI, {17}, &equal, NOTSENT },
{ "hop limit", 0, 1, 1, BI, {64}, &ignore, NOTSENT },
{ "src prefix", 0, 8, 1, BI, {0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{ "src iid", 0, 8, 1, BI, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
{ "dest prefix", 0, 8, 1, BI, {0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{ "dest iid", 56, 8, 1, BI, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
&MSB, LSB },
}
}

◆ ipv6_rule2

const static struct schc_ipv6_rule_t ipv6_rule2
static
Initial value:
= {
2, 10, 10, 10,
{
{ "version", 0, 1, 1, BI, {6}, &equal, NOTSENT },
{ "traffic class", 0, 1, 1, BI, {0}, &equal, NOTSENT },
{ "flow label", 0, 3, 1, BI, {0, 0, 0x20}, &equal, NOTSENT },
{ "length", 0, 2, 1, BI, {0, 0}, &ignore, COMPLENGTH },
{ "next header", 0, 1, 1, BI, {17}, &equal, NOTSENT },
{ "hop limit", 0, 1, 1, BI, {64}, &ignore, NOTSENT },
{ "src prefix", 0, 8, 1, BI, {0x20, 0x01, 0x06, 0xA8, 0x1D, 0x80, 0x20, 0x21},
{ "src iid", 48, 8, 1, BI, {0x02, 0x30, 0x48, 0xFF, 0xFE, 0x5A, 0x00, 0x00},
&MSB, LSB },
{ "dest prefix", 0, 8, 1, BI, {0x20, 0x01, 0x06, 0xA8, 0x1D, 0x80, 0x20, 0x21},
{ "dest iid", 48, 8, 1, BI, {0x50, 0x74, 0xF2, 0xFF, 0xFE, 0xB1, 0x00, 0x00},
&MSB, LSB },
}
}

◆ ipv6_rule3

const static struct schc_ipv6_rule_t ipv6_rule3
static
Initial value:
= {
3, 10, 10, 10,
{
{ "version", 0, 1, 1, BI, {6}, &equal, NOTSENT },
{ "traffic class", 0, 1, 1, BI, {0}, &ignore, NOTSENT },
{ "flow label", 0, 3, 1, BI, {0, 0, 0}, &ignore, NOTSENT },
{ "length", 0, 2, 1, BI, {0, 0}, &ignore, COMPLENGTH },
{ "next header", 0, 1, 1, BI, {17}, &equal, NOTSENT },
{ "hop limit", 0, 1, 1, BI, {64}, &ignore, NOTSENT },
{ "src prefix", 0, 8, 1, BI, {0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{ "src iid", 0, 8, 1, BI, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
{ "dest prefix", 0, 8, 1, BI, {0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{ "dest iid", 56, 8, 1, BI, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
&MSB, LSB },
}
}

◆ node1

const struct schc_device node1 = { 1, 8, &node1_schc_rules }

◆ node1_schc_rules

const struct schc_rule_t* node1_schc_rules[]

◆ node2

const struct schc_device node2 = { 2, 8, &node2_schc_rules}

◆ schc_rule_1

const struct schc_rule_t schc_rule_1 = { 0x01, &compression_rule_1, NOT_FRAGMENTED, 0, 0, 0, 0 }

◆ schc_rule_2

const struct schc_rule_t schc_rule_2 = { 0x02, &compression_rule_1, NO_ACK, 1, 0, 0, 0 }

◆ schc_rule_3

const struct schc_rule_t schc_rule_3 = { 0x03, &compression_rule_1, ACK_ON_ERROR, 3, 6, 1, 0 }

◆ schc_rule_4

const struct schc_rule_t schc_rule_4 = { 0x04, &compression_rule_1, ACK_ALWAYS, 3, 6, 1, 0 }

◆ schc_rule_5

const struct schc_rule_t schc_rule_5 = { 0x05, &compression_rule_2, NOT_FRAGMENTED, 0, 0, 0, 0 }

◆ schc_rule_6

const struct schc_rule_t schc_rule_6 = { 0x06, &compression_rule_2, NO_ACK, 1, 0, 0, 0 }

◆ schc_rule_7

const struct schc_rule_t schc_rule_7 = { 0x07, &compression_rule_2, ACK_ON_ERROR, 3, 6, 1, 0 }

◆ schc_rule_8

const struct schc_rule_t schc_rule_8 = { 0x08, &compression_rule_2, ACK_ALWAYS, 3, 6, 1, 0 }

◆ udp_rule1

const static struct schc_udp_rule_t udp_rule1
static
Initial value:
= {
1, 4, 4, 4,
{
{ "src port", 0, 2, 1, BI, {0x33, 0x16}, &equal, NOTSENT },
{ "dest port", 0, 2, 1, BI, {0x33, 0x16}, &equal, NOTSENT },
{ "length", 0, 2, 1, BI, {0, 0}, &ignore, COMPLENGTH },
{ "checksum", 0, 2, 1, BI, {0, 0}, &ignore, COMPCHK },
}
}

◆ udp_rule2

const static struct schc_udp_rule_t udp_rule2
static
Initial value:
= {
2, 4, 4, 4,
{
{ "src port", 12, 2, 1, BI, {0x33, 0x16}, &MSB, LSB },
{ "dest port", 12, 2, 1, BI, {0x33, 0x16}, &MSB, LSB },
{ "length", 0, 2, 1, BI, {0, 0}, &ignore, COMPLENGTH },
{ "checksum", 0, 2, 1, BI, {0, 0}, &ignore, COMPCHK },
}
}

◆ udp_rule3

const static struct schc_udp_rule_t udp_rule3
static
Initial value:
= {
3, 4, 4, 4,
{
{ "src port", 0, 2, 1, BI, {0x13, 0x89}, &equal, NOTSENT },
{ "dest port", 0, 2, 1, BI, {0x13, 0x88}, &equal, NOTSENT },
{ "length", 0, 2, 1, BI, {0, 0}, &ignore, COMPLENGTH },
{ "checksum", 0, 2, 1, BI, {0, 0}, &ignore, COMPCHK },
}
}
NOTSENT
Definition: config.h:26
schc_rule_8
const struct schc_rule_t schc_rule_8
Definition: rules_example.h:242
schc_rule_6
const struct schc_rule_t schc_rule_6
Definition: rules_example.h:240
coap_rule1
const static struct schc_coap_rule_t coap_rule1
Definition: rules_example.h:109
schc_rule_5
const struct schc_rule_t schc_rule_5
Definition: rules_example.h:239
CC_GET
Definition: picocoap.h:119
schc_rule_4
const struct schc_rule_t schc_rule_4
Definition: rules_example.h:237
schc_rule_7
const struct schc_rule_t schc_rule_7
Definition: rules_example.h:241
MSB
static uint8_t MSB(struct schc_field *target_field, unsigned char *field_value)
The MSB matching operator.
Definition: compressor.c:1088
equal
static uint8_t equal(struct schc_field *target_field, unsigned char *field_value)
The equal matching operator.
Definition: compressor.c:1047
schc_rule_3
const struct schc_rule_t schc_rule_3
Definition: rules_example.h:236
CT_CON
Definition: picocoap.h:105
CT_ACK
Definition: picocoap.h:107
schc_rule_2
const struct schc_rule_t schc_rule_2
Definition: rules_example.h:235
COMPCHK
Definition: config.h:31
DOWN
Definition: config.h:18
MAPPINGSENT
Definition: config.h:28
schc_rule_1
const struct schc_rule_t schc_rule_1
Definition: rules_example.h:234
LSB
Definition: config.h:29
udp_rule1
const static struct schc_udp_rule_t udp_rule1
Definition: rules_example.h:73
CC_PUT
Definition: picocoap.h:121
COAP_V1
Definition: picocoap.h:96
ipv6_rule1
const static struct schc_ipv6_rule_t ipv6_rule1
Definition: rules_example.h:7
UP
Definition: config.h:18
coap_rule3
const static struct schc_coap_rule_t coap_rule3
Definition: rules_example.h:146
coap_rule4
const static struct schc_coap_rule_t coap_rule4
Definition: rules_example.h:162
CC_POST
Definition: picocoap.h:120
CC_CONTENT
Definition: picocoap.h:128
matchmap
static uint8_t matchmap(struct schc_field *target_field, unsigned char *field_value)
The match-map matching operator.
Definition: compressor.c:1145
ignore
static uint8_t ignore(struct schc_field *target_field, unsigned char *field_value)
The ignore matching operator.
Definition: compressor.c:1073
coap_rule2
const static struct schc_coap_rule_t coap_rule2
Definition: rules_example.h:127
CT_NON
Definition: picocoap.h:106
BI
Definition: config.h:18
COMPLENGTH
Definition: config.h:30
VALUESENT
Definition: config.h:27