core.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. */
  12. #ifndef _CAN_CORE_H
  13. #define _CAN_CORE_H
  14. #include <linux/can.h>
  15. #include <linux/skbuff.h>
  16. #include <linux/netdevice.h>
  17. #define CAN_VERSION "20120528"
  18. /* increment this number each time you change some user-space interface */
  19. #define CAN_ABI_VERSION "9"
  20. #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
  21. #define DNAME(dev) ((dev) ? (dev)->name : "any")
  22. /**
  23. * struct can_proto - CAN protocol structure
  24. * @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
  25. * @protocol: protocol number in socket() syscall.
  26. * @ops: pointer to struct proto_ops for sock->ops.
  27. * @prot: pointer to struct proto structure.
  28. */
  29. struct can_proto {
  30. int type;
  31. int protocol;
  32. const struct proto_ops *ops;
  33. struct proto *prot;
  34. };
  35. /* function prototypes for the CAN networklayer core (af_can.c) */
  36. extern int can_proto_register(const struct can_proto *cp);
  37. extern void can_proto_unregister(const struct can_proto *cp);
  38. int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
  39. void (*func)(struct sk_buff *, void *),
  40. void *data, char *ident, struct sock *sk);
  41. extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
  42. canid_t mask,
  43. void (*func)(struct sk_buff *, void *),
  44. void *data);
  45. extern int can_send(struct sk_buff *skb, int loop);
  46. extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
  47. #endif /* !_CAN_CORE_H */