caif_dev.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. * @link_name: Name of the CAIF Link Layer to use.
  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. char link_name[16];
  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_release_client - Release adaptation layer reference to client.
  71. *
  72. * @client_layer: Client layer.
  73. *
  74. * Releases a client/adaptation layer use of the caif stack.
  75. * This function must be used after caif_disconnect_client to
  76. * decrease the reference count of the service layer.
  77. */
  78. void caif_release_client(struct cflayer *client_layer);
  79. /**
  80. * connect_req_to_link_param - Translate configuration parameters
  81. * from socket format to internal format.
  82. * @cnfg: Pointer to configuration handler
  83. * @con_req: Configuration parameters supplied in function
  84. * caif_connect_client
  85. * @channel_setup_param: Parameters supplied to the CAIF Core stack for
  86. * setting up channels.
  87. *
  88. */
  89. int connect_req_to_link_param(struct cfcnfg *cnfg,
  90. struct caif_connect_request *con_req,
  91. struct cfctrl_link_param *channel_setup_param);
  92. /**
  93. * get_caif_conf() - Get the configuration handler.
  94. */
  95. struct cfcnfg *get_caif_conf(void);
  96. #endif /* CAIF_DEV_H_ */