caif_dev.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. *
  49. * This function connects a CAIF channel. The Client must implement
  50. * the struct cflayer. This layer represents the Client layer and holds
  51. * receive functions and control callback functions. Control callback
  52. * function will receive information about connect/disconnect responses,
  53. * flow control etc (see enum caif_control).
  54. * E.g. CAIF Socket will call this function for each socket it connects
  55. * and have one client_layer instance for each socket.
  56. */
  57. int caif_connect_client(struct caif_connect_request *config,
  58. struct cflayer *client_layer);
  59. /**
  60. * caif_disconnect_client - Disconnects a client from the CAIF stack.
  61. *
  62. * @client_layer: Client layer to be removed.
  63. */
  64. int caif_disconnect_client(struct cflayer *client_layer);
  65. /**
  66. * caif_release_client - Release adaptation layer reference to client.
  67. *
  68. * @client_layer: Client layer.
  69. *
  70. * Releases a client/adaptation layer use of the caif stack.
  71. * This function must be used after caif_disconnect_client to
  72. * decrease the reference count of the service layer.
  73. */
  74. void caif_release_client(struct cflayer *client_layer);
  75. /**
  76. * connect_req_to_link_param - Translate configuration parameters
  77. * from socket format to internal format.
  78. * @cnfg: Pointer to configuration handler
  79. * @con_req: Configuration parameters supplied in function
  80. * caif_connect_client
  81. * @channel_setup_param: Parameters supplied to the CAIF Core stack for
  82. * setting up channels.
  83. *
  84. */
  85. int connect_req_to_link_param(struct cfcnfg *cnfg,
  86. struct caif_connect_request *con_req,
  87. struct cfctrl_link_param *channel_setup_param);
  88. /**
  89. * get_caif_conf() - Get the configuration handler.
  90. */
  91. struct cfcnfg *get_caif_conf(void);
  92. #endif /* CAIF_DEV_H_ */