Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
Sniffer implementation for capturing 802.15.4 packets on a given channel. More...
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <assert.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "ca821x-posix/ca821x-posix-evbme.h"
#include "ca821x-posix/ca821x-posix.h"
#include "evbme_messages.h"
Classes | |
struct | PCPS_DATA_indication_pset_8211 |
parameter structures which have been duplicated from mac_messages.h to be able to handle all devices More... | |
struct | PCPS_DATA_indication_pset_8212 |
struct | pcap_hdr_s |
Pcap file header struct as https://wiki.wireshark.org/Development/LibpcapFileFormat. More... | |
struct | pcaprec_hdr_s |
Pcap packet header struct as https://wiki.wireshark.org/Development/LibpcapFileFormat. More... | |
Macros | |
#define | DEFAULT_PIPE "/tmp/cascoda_" |
#define | LINKTYPE_ETHERNET 1 |
Pcap link types, see https://www.tcpdump.org/linktypes.html. More... | |
#define | LINKTYPE_IEEE802_15_4_WITHFCS 195 |
#define | LINKTYPE_IEEE802_15_4_TAP 283 |
#define | MAX_HEADER_LEN 512 |
headers for encapsulating IEEE802.15.4 frames for pcap. More... | |
#define | HEADER_LEN_ETH 14; |
#define | HEADER_LEN_TAP 28; |
#define | HEADER_POSITION_RSSI 16 |
#define | HEADER_POSITION_LQI 24 |
Typedefs | |
typedef enum ca_device_type | ca_device_type |
device type More... | |
typedef struct pcap_hdr_s | pcap_hdr_t |
Pcap file header struct as https://wiki.wireshark.org/Development/LibpcapFileFormat. More... | |
typedef struct pcaprec_hdr_s | pcaprec_hdr_t |
Pcap packet header struct as https://wiki.wireshark.org/Development/LibpcapFileFormat. More... | |
Enumerations | |
enum | ca_device_type { DEV_UNKNOWN = 0 , DEV_CA8210 = 1 , DEV_CA8211 = 2 , DEV_CA8212 = 3 } |
device type More... | |
enum | { OUT_MODE_HEX , OUT_MODE_PCAP } |
Output mode for formatting printed data. More... | |
Functions | |
ca_static_assert (sizeof(pcap_hdr_t)==24) | |
ca_static_assert (sizeof(pcaprec_hdr_t)==16) | |
int | main (int argc, char *argv[]) |
Variables | |
ca_device_type | DeviceType = DEV_UNKNOWN |
uint32_t | link_type = LINKTYPE_IEEE802_15_4_TAP |
uint8_t | ethernet_header [] |
headers for encapsulating IEEE802.15.4 frames for pcap. More... | |
uint8_t | tap_header [] |
enum { ... } | out_mode = OUT_MODE_HEX |
Output mode for formatting printed data. More... | |
struct ca821x_dev | sDeviceRef |
static cascoda device reference More... | |
struct timespec | start |
FILE * | output |
bool | debugMode = false |
Enable logging of extra info to stderr in pcap mode. More... | |
uint8_t | channel = 0 |
Channel we are sniffing on. More... | |
char | default_pipe [30] |
Static storage for default pipe name. More... | |
char * | dPipeName = NULL |
Pointer to dynamic pipe name. More... | |
uint32_t | time_till_new_capture = 0 |
If this is nonzero, then wireshark will be used in ring buffer mode, and a new capture will be started once every "time_till_new_capture" seconds. More... | |
Sniffer implementation for capturing 802.15.4 packets on a given channel.
#define DEFAULT_PIPE "/tmp/cascoda_" |
#define HEADER_LEN_ETH 14; |
#define HEADER_LEN_TAP 28; |
#define HEADER_POSITION_LQI 24 |
#define HEADER_POSITION_RSSI 16 |
#define LINKTYPE_ETHERNET 1 |
Pcap link types, see https://www.tcpdump.org/linktypes.html.
#define LINKTYPE_IEEE802_15_4_TAP 283 |
#define LINKTYPE_IEEE802_15_4_WITHFCS 195 |
#define MAX_HEADER_LEN 512 |
headers for encapsulating IEEE802.15.4 frames for pcap.
typedef enum ca_device_type ca_device_type |
device type
typedef struct pcap_hdr_s pcap_hdr_t |
Pcap file header struct as https://wiki.wireshark.org/Development/LibpcapFileFormat.
typedef struct pcaprec_hdr_s pcaprec_hdr_t |
Pcap packet header struct as https://wiki.wireshark.org/Development/LibpcapFileFormat.
anonymous enum |
enum ca_device_type |
ca_static_assert | ( | sizeof(pcap_hdr_t) | = =24 | ) |
ca_static_assert | ( | sizeof(pcaprec_hdr_t) | = =16 | ) |
int main | ( | int | argc, |
char * | argv[] | ||
) |
uint8_t channel = 0 |
Channel we are sniffing on.
bool debugMode = false |
Enable logging of extra info to stderr in pcap mode.
char default_pipe[30] |
Static storage for default pipe name.
ca_device_type DeviceType = DEV_UNKNOWN |
char* dPipeName = NULL |
Pointer to dynamic pipe name.
uint8_t ethernet_header[] |
headers for encapsulating IEEE802.15.4 frames for pcap.
for TAP header doc see: https://github.com/jkcko/ieee802.15.4-tap/blob/master/IEEE%20802.15.4%20TAP%20Link%20Type%20Specification.pdf
uint32_t link_type = LINKTYPE_IEEE802_15_4_TAP |
enum { ... } out_mode |
Output mode for formatting printed data.
FILE* output |
struct ca821x_dev sDeviceRef |
static cascoda device reference
struct timespec start |
uint8_t tap_header[] |
uint32_t time_till_new_capture = 0 |
If this is nonzero, then wireshark will be used in ring buffer mode, and a new capture will be started once every "time_till_new_capture" seconds.