socket.h
00001 #ifndef SOCKET_H_
00002 #define SOCKET_H_
00003 
00004 #include "config.h"
00005 #include "types.h"
00006 
00011 struct can_msg{
00012         u16 id : 11;
00013         u8 len :  4;
00014         u8 rtr :  1;
00015         union{
00016                 u8 data[8];
00017                 struct{
00018                         u8 function_code;
00019                         u8 function_specific[7];
00020                 };
00021         };
00022 };
00023 
00024 struct socket;
00025 typedef void (*sock_recv_hook)(struct socket*);
00026 
00027 struct canel{
00028         struct canel *next;
00029         struct can_msg msg;
00030 };
00031 
00032 struct socket{
00033         struct canel *rd, *wr;
00034         sock_recv_hook recv_hook;
00035         volatile _Bool recv_hook_running;
00036 };
00037 
00039 
00040 void sock_init(struct socket*);
00041 void sock_register_recv_hook(struct socket*, sock_recv_hook);
00042 void sock_push(struct socket*, struct can_msg*);
00043 struct can_msg *sock_pull(struct socket*);
00044 
00045 #endif
 All Classes Files Functions Enumerations Enumerator Defines