This repository has been archived by the owner on Apr 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhomeplug-av.h
71 lines (56 loc) · 1.53 KB
/
homeplug-av.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef __HOMEPLUG_AV_H
#define __HOMEPLUG_AV_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <stdint.h>
#define ATHEROS_HOMEPLUG_AV { 0x00, 0xb0, 0x52, 0x00, 0x00, 0x01 }
#define BUF_SIZ 1400
#define GET_DEVICE_SW_VERSION_REQ_LEN (3 + 47)
#define GET_DEVICE_SW_VERSION_REQ_TYPE 0xa000
#define GET_DEVICE_SW_VERSION_RES_TYPE 0xa001
#define NETWORK_INFO_REQ_LEN (3 + 47)
#define NETWORK_INFO_REQ_TYPE 0xa038
#define NETWORK_INFO_RES_TYPE 0xa039
struct HomePlugPacket {
struct MACManagementHeader *header;
char oui[3];
void *payload;
};
struct MACManagementHeader {
uint8_t version;
uint16_t type;
};
struct GetDeviceSWVersionResponse {
uint8_t status;
uint8_t deviceId;
uint8_t versionLength;
char *version;
uint8_t upgradable;
};
struct NetworkInfoResponse {
uint8_t logicalNetworkNumber;
struct NetworkInformation **networks;
uint8_t stationNumber;
struct StationInformation **stations;
};
struct NetworkInformation {
uint8_t networkId[7];
uint8_t shortNetworkId;
uint8_t terminalEquipmentIdentifier;
uint8_t stationRole;
uint8_t ccoMAC[6];
uint8_t ccoTEid;
};
struct StationInformation {
uint8_t stationMAC[6];
uint8_t stationTEid;
uint8_t firstBridgedNode[6];
uint8_t averagePHYTXDataRateMbps;
uint8_t averagePHYRXDataRateMbps;
};
struct HomePlugPacket* parseResponse(char* buf, int len);
void freeResponse(struct HomePlugPacket *response);
size_t preparePacket(char *buf, size_t maxsize, struct HomePlugPacket *pkt);
#endif