Go to the documentation of this file.00001
00015 #ifndef SOCKET_H_
00016 #define SOCKET_H_
00017
00018 #include "config.h"
00019 #include "types.h"
00020
00025 struct can_msg{
00026 u16 id : 11;
00027 u8 len : 4;
00028 u8 rtr : 1;
00029 union{
00030 u8 data[8];
00031 struct{
00032 u8 function_code;
00033 u8 function_specific[7];
00034 };
00035 };
00036 };
00037
00038 struct socket;
00039 typedef void (*sock_recv_hook)(struct socket*);
00040
00041 struct canel{
00042 struct canel *next;
00043 struct can_msg msg;
00044 };
00045
00046 struct socket{
00047 struct canel *rd, *wr;
00048 sock_recv_hook recv_hook;
00049 volatile _Bool recv_hook_running;
00050 };
00051
00053
00054 void sock_init(struct socket*);
00055 void sock_register_recv_hook(struct socket*, sock_recv_hook);
00056 void sock_push(struct socket*, struct can_msg*);
00057 struct can_msg *sock_pull(struct socket*);
00058
00059 #endif