rmnet_ctl.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  3. *
  4. * RMNET_CTL header
  5. *
  6. */
  7. #ifndef _RMNET_CTL_H_
  8. #define _RMNET_CTL_H_
  9. #include <linux/skbuff.h>
  10. #define CONFIG_RMNET_CTL 1
  11. enum rmnet_ctl_log_lvl {
  12. RMNET_CTL_LOG_CRIT,
  13. RMNET_CTL_LOG_ERR,
  14. RMNET_CTL_LOG_INFO,
  15. RMNET_CTL_LOG_DEBUG,
  16. };
  17. #define rmnet_ctl_log_err(msg, rc, data, len) \
  18. rmnet_ctl_log(RMNET_CTL_LOG_ERR, msg, rc, data, len)
  19. #define rmnet_ctl_log_info(msg, data, len) \
  20. rmnet_ctl_log(RMNET_CTL_LOG_INFO, msg, 0, data, len)
  21. #define rmnet_ctl_log_debug(msg, data, len) \
  22. rmnet_ctl_log(RMNET_CTL_LOG_DEBUG, msg, 0, data, len)
  23. struct rmnet_ctl_client_hooks {
  24. void (*ctl_dl_client_hook)(struct sk_buff *skb);
  25. };
  26. #ifdef CONFIG_RMNET_CTL
  27. void *rmnet_ctl_register_client(struct rmnet_ctl_client_hooks *hook);
  28. int rmnet_ctl_unregister_client(void *handle);
  29. int rmnet_ctl_send_client(void *handle, struct sk_buff *skb);
  30. void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg,
  31. int rc, const void *data, unsigned int len);
  32. #else
  33. static inline void *rmnet_ctl_register_client(
  34. struct rmnet_ctl_client_hooks *hook)
  35. {
  36. return NULL;
  37. }
  38. static inline int rmnet_ctl_unregister_client(void *handle)
  39. {
  40. return -EINVAL;
  41. }
  42. static inline int rmnet_ctl_send_client(void *handle, struct sk_buff *skb)
  43. {
  44. return -EINVAL;
  45. }
  46. static inline void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg,
  47. int rc, const void *data, unsigned int len)
  48. {
  49. }
  50. #endif /* CONFIG_RMNET_CTL */
  51. #endif /* _RMNET_CTL_H_ */