]> rtime.felk.cvut.cz Git - can-eth-gw.git/blobdiff - kernel/canethgw.h
passing parameters to kernel via ioctl
[can-eth-gw.git] / kernel / canethgw.h
index 5acb34b52db16f3c17230e59b071edcdceb4b06f..c082fcac57951dd492b723afc9123a1611c7e733 100644 (file)
@@ -1,4 +1,74 @@
-static int  gw_udp_recv( void* data );
-static void gw_udp_send( struct can_frame* cf, struct in_addr ipaddr, u16 port );
-static int  gw_can_recv( void* data );
-static void gw_can_send( struct can_frame* cf, int ifidx );
+#ifndef CANETHGW_H
+#define CANETHGW_H
+
+#include <linux/types.h>
+#include <linux/can.h>
+
+/* these are from gw.h */
+struct rtcanmsg {
+       __u8  can_family;
+       __u8  gwtype;
+       __u16 flags;
+};
+
+/* CEGW_CMD_INFO values */
+enum {
+       CEGW_RULE_CAN_ETH,
+       CEGW_RULE_ETH_CAN,
+       CEGW_LISTEN,
+       CEGW_FLUSH,
+       __CEGW_CMD_MAX
+};
+#define CEGW_CMD_MAX (__CEGW_CMD_MAX - 1)
+
+/* rtnetlink attributes */
+enum {
+       CEGW_TYPE,
+       CEGW_CAN_IFINDEX,
+       CEGW_ETH_IP,
+       CEGW_ETH_PORT,
+       CEGW_CMD_INFO,
+       __CEGW_MAX
+};
+#define CEGW_MAX (__CEGW_MAX - 1)
+
+struct cegw_udp_dst
+{
+       __u32 len;
+       struct sockaddr addr;
+};
+
+struct cegw_udp_dst4
+{
+       __u32 len;
+       struct sockaddr_in addr;
+};
+
+struct cegw_ioctl
+{
+       __u32 can_sock;
+       __u32 udp_sock;;
+       __u32 udp_dstcnt;
+       __u32 udp_addrlen;
+       struct sockaddr_in udp_dst[0];
+};
+
+struct cegw_job
+{
+       struct socket* can_sock;
+       struct socket* udp_sock;
+       __u32  udp_dstcnt;
+       struct sockaddr_in* udp_dst;
+};
+
+#define CEGW_IOCTL_BASE 'c'
+#define CEGW_IOCTL_START _IOW(CEGW_IOCTL_BASE, 0, struct cegw_ioctl)
+
+/* ToDo:
+ *     CEGW_HANDLED
+ *     CEGW_DROPPED
+ *     CEGW_ETH_PROTO
+ */
+
+#endif /* CANETHGW_H */
+