25#ifndef __RTCFG_FRAME_H_
26#define __RTCFG_FRAME_H_
28#include <linux/init.h>
29#include <linux/if_packet.h>
30#include <asm/byteorder.h>
32#include <rtcfg/rtcfg_event.h>
34#define ETH_RTCFG 0x9022
36#define RTCFG_SKB_PRIO \
37 RTSKB_PRIO_VALUE(QUEUE_MIN_PRIO - 1, RTSKB_DEF_NRT_CHANNEL)
39#define RTCFG_ID_STAGE_1_CFG 0
40#define RTCFG_ID_ANNOUNCE_NEW 1
41#define RTCFG_ID_ANNOUNCE_REPLY 2
42#define RTCFG_ID_STAGE_2_CFG 3
43#define RTCFG_ID_STAGE_2_CFG_FRAG 4
44#define RTCFG_ID_ACK_CFG 5
45#define RTCFG_ID_READY 6
46#define RTCFG_ID_HEARTBEAT 7
47#define RTCFG_ID_DEAD_STATION 8
49#define RTCFG_ADDRSIZE_MAC 0
50#define RTCFG_ADDRSIZE_IP 4
51#define RTCFG_MAX_ADDRSIZE RTCFG_ADDRSIZE_IP
53#define RTCFG_FLAG_STAGE_2_DATA 0
54#define RTCFG_FLAG_READY 1
56#define _RTCFG_FLAG_STAGE_2_DATA (1 << RTCFG_FLAG_STAGE_2_DATA)
57#define _RTCFG_FLAG_READY (1 << RTCFG_FLAG_READY)
59struct rtcfg_frm_head {
60#if defined(__LITTLE_ENDIAN_BITFIELD)
63#elif defined(__BIG_ENDIAN_BITFIELD)
67#error unsupported byte order
69} __attribute__((packed));
71struct rtcfg_frm_stage_1_cfg {
72 struct rtcfg_frm_head head;
79} __attribute__((packed));
81struct rtcfg_frm_announce {
82 struct rtcfg_frm_head head;
87} __attribute__((packed));
89struct rtcfg_frm_stage_2_cfg {
90 struct rtcfg_frm_head head;
96} __attribute__((packed));
98struct rtcfg_frm_stage_2_cfg_frag {
99 struct rtcfg_frm_head head;
102} __attribute__((packed));
104struct rtcfg_frm_ack_cfg {
105 struct rtcfg_frm_head head;
107} __attribute__((packed));
109struct rtcfg_frm_simple {
110 struct rtcfg_frm_head head;
111} __attribute__((packed));
113struct rtcfg_frm_dead_station {
114 struct rtcfg_frm_head head;
117 u8 physical_addr[32];
118} __attribute__((packed));
120int rtcfg_send_stage_1(
struct rtcfg_connection *conn);
121int rtcfg_send_stage_2(
struct rtcfg_connection *conn,
int send_data);
122int rtcfg_send_stage_2_frag(
struct rtcfg_connection *conn);
123int rtcfg_send_announce_new(
int ifindex);
124int rtcfg_send_announce_reply(
int ifindex, u8 *dest_mac_addr);
125int rtcfg_send_ack(
int ifindex);
126int rtcfg_send_dead_station(
struct rtcfg_connection *conn);
128int rtcfg_send_simple_frame(
int ifindex,
int frame_id, u8 *dest_addr);
130#define rtcfg_send_ready(ifindex) \
131 rtcfg_send_simple_frame(ifindex, RTCFG_ID_READY, NULL)
132#define rtcfg_send_heartbeat(ifindex) \
133 rtcfg_send_simple_frame(ifindex, RTCFG_ID_HEARTBEAT, \
134 device[ifindex].spec.clt.srv_mac_addr)
136int __init rtcfg_init_frames(
void);
137void rtcfg_cleanup_frames(
void);