caif_dev.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) ST-Ericsson AB 2010
  3. * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
  4. * License terms: GNU General Public License (GPL) version 2
  5. */
  6. #ifndef CAIF_DEV_H_
  7. #define CAIF_DEV_H_
  8. #include <net/caif/caif_layer.h>
  9. #include <net/caif/cfcnfg.h>
  10. #include <linux/caif/caif_socket.h>
  11. #include <linux/if.h>
  12. /**
  13. * struct caif_param - CAIF parameters.
  14. * @size: Length of data
  15. * @data: Binary Data Blob
  16. */
  17. struct caif_param {
  18. u16 size;
  19. u8 data[256];
  20. };
  21. /**
  22. * struct caif_connect_request - Request data for CAIF channel setup.
  23. * @protocol: Type of CAIF protocol to use (at, datagram etc)
  24. * @sockaddr: Socket address to connect.
  25. * @priority: Priority of the connection.
  26. * @link_selector: Link selector (high bandwidth or low latency)
  27. * @ifindex: kernel index of the interface.
  28. * @param: Connect Request parameters (CAIF_SO_REQ_PARAM).
  29. *
  30. * This struct is used when connecting a CAIF channel.
  31. * It contains all CAIF channel configuration options.
  32. */
  33. struct caif_connect_request {
  34. enum caif_protocol_type protocol;
  35. struct sockaddr_caif sockaddr;
  36. enum caif_channel_priority priority;
  37. enum caif_link_selector link_selector;
  38. int ifindex;
  39. struct caif_param param;
  40. };
  41. /**
  42. * caif_connect_client - Connect a client to CAIF Core Stack.
  43. * @config: Channel setup parameters, specifying what address
  44. * to connect on the Modem.
  45. * @client_layer: User implementation of client layer. This layer
  46. * MUST have receive and control callback functions
  47. * implemented.
  48. * @ifindex: Link layer interface index used for this connection.
  49. * @headroom: Head room needed by CAIF protocol.
  50. * @tailroom: Tail room needed by CAIF protocol.
  51. *
  52. * This function connects a CAIF channel. The Client must implement
  53. * the struct cflayer. This layer represents the Client layer and holds
  54. * receive functions and control callback functions. Control callback
  55. * function will receive information about connect/disconnect responses,
  56. * flow control etc (see enum caif_control).
  57. * E.g. CAIF Socket will call this function for each socket it connects
  58. * and have one client_layer instance for each socket.
  59. */
  60. int caif_connect_client(struct caif_connect_request *conn_req,
  61. struct cflayer *client_layer, int *ifindex,
  62. int *headroom, int *tailroom);
  63. /**
  64. * caif_disconnect_client - Disconnects a client from the CAIF stack.
  65. *
  66. * @client_layer: Client layer to be removed.
  67. */
  68. int caif_disconnect_client(struct cflayer *client_layer);
  69. /**
  70. * caif_connect_req_to_link_param - Translate configuration parameters
  71. * from socket format to internal format.
  72. * @cnfg: Pointer to configuration handler
  73. * @con_req: Configuration parameters supplied in function
  74. * caif_connect_client
  75. * @channel_setup_param: Parameters supplied to the CAIF Core stack for
  76. * setting up channels.
  77. *
  78. */
  79. int caif_connect_req_to_link_param(struct cfcnfg *cnfg,
  80. struct caif_connect_request *con_req,
  81. struct cfctrl_link_param *setup_param);
  82. #endif /* CAIF_DEV_H_ */