/include/gprs-context.h

https://github.com/Paulxia/ofono · C Header · 120 lines · 80 code · 20 blank · 20 comment · 0 complexity · 4038acf88d1764d5328b710e55a75bd7 MD5 · raw file

  1. /*
  2. *
  3. * oFono - Open Source Telephony
  4. *
  5. * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. *
  20. */
  21. #ifndef __OFONO_GPRS_CONTEXT_H
  22. #define __OFONO_GPRS_CONTEXT_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #include <ofono/types.h>
  27. struct ofono_gprs_context;
  28. #define OFONO_GPRS_MAX_APN_LENGTH 127
  29. #define OFONO_GPRS_MAX_USERNAME_LENGTH 63
  30. #define OFONO_GPRS_MAX_PASSWORD_LENGTH 255
  31. enum ofono_gprs_proto {
  32. OFONO_GPRS_PROTO_IP = 0,
  33. OFONO_GPRS_PROTO_IPV6,
  34. OFONO_GPRS_PROTO_IPV4V6,
  35. };
  36. enum ofono_gprs_context_type {
  37. OFONO_GPRS_CONTEXT_TYPE_ANY = 0,
  38. OFONO_GPRS_CONTEXT_TYPE_INTERNET,
  39. OFONO_GPRS_CONTEXT_TYPE_MMS,
  40. OFONO_GPRS_CONTEXT_TYPE_WAP,
  41. OFONO_GPRS_CONTEXT_TYPE_IMS,
  42. };
  43. struct ofono_gprs_primary_context {
  44. unsigned int cid;
  45. int direction;
  46. char apn[OFONO_GPRS_MAX_APN_LENGTH + 1];
  47. char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
  48. char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
  49. enum ofono_gprs_proto proto;
  50. };
  51. typedef void (*ofono_gprs_context_cb_t)(const struct ofono_error *error,
  52. void *data);
  53. struct ofono_gprs_context_driver {
  54. const char *name;
  55. int (*probe)(struct ofono_gprs_context *gc, unsigned int vendor,
  56. void *data);
  57. void (*remove)(struct ofono_gprs_context *gc);
  58. void (*activate_primary)(struct ofono_gprs_context *gc,
  59. const struct ofono_gprs_primary_context *ctx,
  60. ofono_gprs_context_cb_t cb, void *data);
  61. void (*deactivate_primary)(struct ofono_gprs_context *gc,
  62. unsigned int id,
  63. ofono_gprs_context_cb_t cb, void *data);
  64. };
  65. void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
  66. unsigned int id);
  67. int ofono_gprs_context_driver_register(const struct ofono_gprs_context_driver *d);
  68. void ofono_gprs_context_driver_unregister(const struct ofono_gprs_context_driver *d);
  69. struct ofono_gprs_context *ofono_gprs_context_create(struct ofono_modem *modem,
  70. unsigned int vendor,
  71. const char *driver, void *data);
  72. void ofono_gprs_context_remove(struct ofono_gprs_context *gc);
  73. void ofono_gprs_context_set_data(struct ofono_gprs_context *gc, void *data);
  74. void *ofono_gprs_context_get_data(struct ofono_gprs_context *gc);
  75. struct ofono_modem *ofono_gprs_context_get_modem(struct ofono_gprs_context *gc);
  76. void ofono_gprs_context_set_type(struct ofono_gprs_context *gc,
  77. enum ofono_gprs_context_type type);
  78. void ofono_gprs_context_set_interface(struct ofono_gprs_context *gc,
  79. const char *interface);
  80. void ofono_gprs_context_set_ipv4_address(struct ofono_gprs_context *gc,
  81. const char *address,
  82. gboolean static_ip);
  83. void ofono_gprs_context_set_ipv4_netmask(struct ofono_gprs_context *gc,
  84. const char *netmask);
  85. void ofono_gprs_context_set_ipv4_gateway(struct ofono_gprs_context *gc,
  86. const char *gateway);
  87. void ofono_gprs_context_set_ipv4_dns_servers(struct ofono_gprs_context *gc,
  88. const char **dns);
  89. void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
  90. const char *address);
  91. void ofono_gprs_context_set_ipv6_prefix_length(struct ofono_gprs_context *gc,
  92. unsigned char length);
  93. void ofono_gprs_context_set_ipv6_gateway(struct ofono_gprs_context *gc,
  94. const char *gateway);
  95. void ofono_gprs_context_set_ipv6_dns_servers(struct ofono_gprs_context *gc,
  96. const char **dns);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* __OFONO_GPRS_CONTEXT_H */