core.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * linux/can/core.h
  3. *
  4. * Protoypes and definitions for CAN protocol modules using the PF_CAN core
  5. *
  6. * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
  7. * Urs Thuermann <urs.thuermann@volkswagen.de>
  8. * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  9. * All rights reserved.
  10. *
  11. * Send feedback to <socketcan-users@lists.berlios.de>
  12. *
  13. */
  14. #ifndef CAN_CORE_H
  15. #define CAN_CORE_H
  16. #include <linux/can.h>
  17. #include <linux/skbuff.h>
  18. #include <linux/netdevice.h>
  19. #define CAN_VERSION "20090105"
  20. /* increment this number each time you change some user-space interface */
  21. #define CAN_ABI_VERSION "8"
  22. #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
  23. #define DNAME(dev) ((dev) ? (dev)->name : "any")
  24. /**
  25. * struct can_proto - CAN protocol structure
  26. * @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
  27. * @protocol: protocol number in socket() syscall.
  28. * @ops: pointer to struct proto_ops for sock->ops.
  29. * @prot: pointer to struct proto structure.
  30. */
  31. struct can_proto {
  32. int type;
  33. int protocol;
  34. struct proto_ops *ops;
  35. struct proto *prot;
  36. };
  37. /* function prototypes for the CAN networklayer core (af_can.c) */
  38. extern int can_proto_register(struct can_proto *cp);
  39. extern void can_proto_unregister(struct can_proto *cp);
  40. extern int can_rx_register(struct net_device *dev, canid_t can_id,
  41. canid_t mask,
  42. void (*func)(struct sk_buff *, void *),
  43. void *data, char *ident);
  44. extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
  45. canid_t mask,
  46. void (*func)(struct sk_buff *, void *),
  47. void *data);
  48. extern int can_send(struct sk_buff *skb, int loop);
  49. #endif /* CAN_CORE_H */