Skip to content

Commit

Permalink
Port shadow demo from product 4 (FreeRTOS#341)
Browse files Browse the repository at this point in the history
* Port shadow demo from product 4

* Fix coding style and formating

* Change assert to configASSERT and fix comments.

* Delete the demo task when it finish

* Relocate the shadow demo code under AWS folder.

* Fix uncrustify.

* Update FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/ShadowDemoMainExample.c

Co-authored-by: Oscar Michael Abrina <[email protected]>

* Update FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/ShadowDemoMainExample.c

Co-authored-by: Oscar Michael Abrina <[email protected]>

* Fix comments

* Update from comments.

Co-authored-by: Oscar Michael Abrina <[email protected]>
  • Loading branch information
andysun2015 and yourslab authored Oct 19, 2020
1 parent 2eed409 commit 977b3ab
Show file tree
Hide file tree
Showing 36 changed files with 9,132 additions and 0 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
char pkt1[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x30, 0x09, 0x9c, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x07, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x35, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02,
0x40, 0x00, 0xdf, 0xab, 0x00, 0x00, 0x02, 0x04,
0x05, 0xb4, 0x01, 0x01, 0x04, 0x02 };

char pkt2[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa6, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92 };

char pkt3[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0x9e, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x0d, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 };

char pkt4[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x02, 0x27, 0x09, 0x9f, 0x40, 0x00, 0x80, 0x06,
0x6d, 0x0d, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x18,
0x42, 0xd8, 0x84, 0x3e, 0x00, 0x00, 0x47, 0x45,
0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50,
0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63,
0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0x2c,
0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x78,
0x2d, 0x78, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70,
0x2c, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f,
0x6a, 0x70, 0x65, 0x67, 0x2c, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x70, 0x6a, 0x70, 0x65,
0x67, 0x2c, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76,
0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, 0x65, 0x78,
0x63, 0x65, 0x6c, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x6d, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2c,
0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64,
0x2e, 0x6d, 0x73, 0x2d, 0x70, 0x6f, 0x77, 0x65,
0x72, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2c, 0x20,
0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73,
0x2d, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x70,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, 0x2d, 0x78,
0x62, 0x61, 0x70, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d,
0x78, 0x70, 0x73, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65, 0x6e, 0x74, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x78, 0x61, 0x6d, 0x6c, 0x2b, 0x78, 0x6d,
0x6c, 0x2c, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a,
0x20, 0x65, 0x6e, 0x2d, 0x67, 0x62, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45,
0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a,
0x20, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x20, 0x64,
0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x0d, 0x0a,
0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65,
0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69,
0x6c, 0x6c, 0x61, 0x2f, 0x34, 0x2e, 0x30, 0x20,
0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69,
0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49,
0x45, 0x20, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x57,
0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e,
0x54, 0x20, 0x35, 0x2e, 0x31, 0x3b, 0x20, 0x53,
0x56, 0x31, 0x3b, 0x20, 0x47, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x54, 0x35, 0x3b, 0x20, 0x2e, 0x4e,
0x45, 0x54, 0x20, 0x43, 0x4c, 0x52, 0x20, 0x32,
0x2e, 0x30, 0x2e, 0x35, 0x30, 0x37, 0x32, 0x37,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x30, 0x2e, 0x30,
0x34, 0x35, 0x30, 0x36, 0x2e, 0x36, 0x34, 0x38,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x35, 0x2e, 0x32,
0x31, 0x30, 0x32, 0x32, 0x29, 0x0d, 0x0a, 0x48,
0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x39, 0x32,
0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x31,
0x32, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b,
0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76,
0x65, 0x0d, 0x0a, 0x0d, 0x0a };

char pkt5[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa5, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92 };

char pkt6[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa1, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x0a, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 };

char pkt7[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x02, 0x27, 0x09, 0xa2, 0x40, 0x00, 0x80, 0x06,
0x6d, 0x0a, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x18,
0x42, 0xd8, 0x84, 0x3e, 0x00, 0x00, 0x47, 0x45,
0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50,
0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63,
0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0x2c,
0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x78,
0x2d, 0x78, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70,
0x2c, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f,
0x6a, 0x70, 0x65, 0x67, 0x2c, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x70, 0x6a, 0x70, 0x65,
0x67, 0x2c, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76,
0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, 0x65, 0x78,
0x63, 0x65, 0x6c, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x6d, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2c,
0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64,
0x2e, 0x6d, 0x73, 0x2d, 0x70, 0x6f, 0x77, 0x65,
0x72, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2c, 0x20,
0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73,
0x2d, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x70,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, 0x2d, 0x78,
0x62, 0x61, 0x70, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d,
0x78, 0x70, 0x73, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65, 0x6e, 0x74, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x78, 0x61, 0x6d, 0x6c, 0x2b, 0x78, 0x6d,
0x6c, 0x2c, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a,
0x20, 0x65, 0x6e, 0x2d, 0x67, 0x62, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45,
0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a,
0x20, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x20, 0x64,
0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x0d, 0x0a,
0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65,
0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69,
0x6c, 0x6c, 0x61, 0x2f, 0x34, 0x2e, 0x30, 0x20,
0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69,
0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49,
0x45, 0x20, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x57,
0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e,
0x54, 0x20, 0x35, 0x2e, 0x31, 0x3b, 0x20, 0x53,
0x56, 0x31, 0x3b, 0x20, 0x47, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x54, 0x35, 0x3b, 0x20, 0x2e, 0x4e,
0x45, 0x54, 0x20, 0x43, 0x4c, 0x52, 0x20, 0x32,
0x2e, 0x30, 0x2e, 0x35, 0x30, 0x37, 0x32, 0x37,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x30, 0x2e, 0x30,
0x34, 0x35, 0x30, 0x36, 0x2e, 0x36, 0x34, 0x38,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x35, 0x2e, 0x32,
0x31, 0x30, 0x32, 0x32, 0x29, 0x0d, 0x0a, 0x48,
0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x39, 0x32,
0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x31,
0x32, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b,
0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76,
0x65, 0x0d, 0x0a, 0x0d, 0x0a };

char pkt8[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x03, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa4, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92 };

char pkt9[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa3, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x08, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 };

char pkt10[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x04, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa3, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92 };

char pkt11[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa6, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x05, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 };

char pkt12[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa7, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x04, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x14,
0x00, 0x00, 0x43, 0xf4, 0x00, 0x00 };


typedef struct
{
char *pcData;
int iDataLen;
} xPacketData;

xPacketData xAllPackets[] =
{
{ pkt1, sizeof( pkt1 ) },
// { pkt2, sizeof( pkt2 ) },
{ pkt3, sizeof( pkt3 ) },
{ pkt4, sizeof( pkt4 ) },
// { pkt5, sizeof( pkt5 ) },
{ pkt6, sizeof( pkt6 ) },
{ pkt7, sizeof( pkt7 ) },
{ pkt8, sizeof( pkt8 ) },
{ pkt9, sizeof( pkt9 ) },
{ pkt10, sizeof( pkt10 ) },
// { pkt11, sizeof( pkt11 ) },
// { pkt12, sizeof( pkt12 ) },
// { pkt13, sizeof( pkt13 ) },
// { pkt14, sizeof( pkt14 ) },
// { pkt15, sizeof( pkt15 ) },
// { pkt16, sizeof( pkt16 ) },
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
* Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/


#ifndef __WIN32_EXTENSIONS_H__
#define __WIN32_EXTENSIONS_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Definitions */

/*!
\brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit().
*/
struct pcap_send_queue
{
u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field.
u_int len; ///< Current size of the queue, in bytes.
char *buffer; ///< Buffer containing the packets to be sent.
};

typedef struct pcap_send_queue pcap_send_queue;

/*!
\brief This typedef is a support for the pcap_get_airpcap_handle() function
*/
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
typedef struct _AirpcapHandle *PAirpcapHandle;
#endif

#define BPF_MEM_EX_IMM 0xc0
#define BPF_MEM_EX_IND 0xe0

/*used for ST*/
#define BPF_MEM_EX 0xc0
#define BPF_TME 0x08

#define BPF_LOOKUP 0x90
#define BPF_EXECUTE 0xa0
#define BPF_INIT 0xb0
#define BPF_VALIDATE 0xc0
#define BPF_SET_ACTIVE 0xd0
#define BPF_RESET 0xe0
#define BPF_SET_MEMORY 0x80
#define BPF_GET_REGISTER_VALUE 0x70
#define BPF_SET_REGISTER_VALUE 0x60
#define BPF_SET_WORKING 0x50
#define BPF_SET_ACTIVE_READ 0x40
#define BPF_SET_AUTODELETION 0x30
#define BPF_SEPARATION 0xff

/* Prototypes */
pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);

void pcap_sendqueue_destroy(pcap_send_queue* queue);

int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);

u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);

HANDLE pcap_getevent(pcap_t *p);

struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);

int pcap_setuserbuffer(pcap_t *p, int size);

int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);

int pcap_live_dump_ended(pcap_t *p, int sync);

int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data);

int pcap_start_oem(char* err_str, int flags);

PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);

#ifdef __cplusplus
}
#endif

#endif //__WIN32_EXTENSIONS_H__
Loading

0 comments on commit 977b3ab

Please sign in to comment.