cmd.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2009 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #if !defined(TINYDEMO_CMD_H)
  23. #define TINYDEMO_CMD_H
  24. #include "demo_config.h"
  25. #include "tsk_params.h"
  26. _BEGIN_DECLS
  27. typedef enum cmd_type_e {
  28. cmd_none,
  29. cmd_audio, /* ++audio | ++a*/
  30. cmd_audiovideo, /* ++audiovideo | ++av*/
  31. cmd_config_session, /* ++config-session | ++css */
  32. cmd_config_stack, /* ++config-stack | ++cst*/
  33. cmd_dtmf, /*++dtmf*/
  34. cmd_dump, /*++dump | ++d*/
  35. cmd_ect, /*++ect*/
  36. cmd_exit, /*++exit | ++e | ++quit | ++q*/
  37. cmd_file, /* ++file | ++f*/
  38. cmd_hangup, /* ++hangup | ++hu */
  39. cmd_help, /* ++help | ++h */
  40. cmd_hold, /* ++hold | ++ho */
  41. cmd_large_message, /* ++large-message | ++lm */
  42. cmd_message, /* ++message | ++m*/
  43. cmd_options, /* ++options | ++opt*/
  44. cmd_publish, /* ++publish | ++pub*/
  45. cmd_register, /* ++register | ++reg */
  46. cmd_resume, /* ++resume | ++res */
  47. cmd_run, /* ++run | ++r*/
  48. cmd_scenario, /* ++scenario | ++sn*/
  49. cmd_sleep, /* ++sleep */
  50. cmd_sms, /* ++sms */
  51. cmd_stop, /* ++stop */
  52. cmd_subscribe, /* ++subscribe | ++sub */
  53. cmd_video, /* ++video | ++v */
  54. }
  55. cmd_type_t;
  56. typedef enum opt_type_e {
  57. opt_none,
  58. opt_amf, /* --amf 0x85FF */
  59. opt_caps, /* --caps +g.oma.sip-im or language=en,fr*/
  60. opt_dhcpv4, /* --dhcpv4 */
  61. opt_dhcpv6, /* --dhcpv6 */
  62. opt_dname, /* --dname bob */
  63. opt_dns_naptr, /* --dns-naptr */
  64. opt_from, /* --from sip:alice@open-ims.test */
  65. opt_event, /* --event 2 */
  66. opt_expires, /* --expires|--xp 30 */
  67. opt_header, /* --header Supported=norefersub */
  68. opt_impi, /* --impi bob@open-ims.test */
  69. opt_impu, /* --impu sip:bob@open-ims.test */
  70. opt_ipv6, /* --ipv6 */
  71. opt_local_ip, /* --local-ip 192.168.0.10 */
  72. opt_local_port, /* --local-port 5060 */
  73. opt_opid, /* --opid 0xA712F5D04B */
  74. opt_password, /* --password|--pwd mysecret */
  75. opt_path, /* --path /cygdrive/c/Projects/sample.cfg */
  76. opt_payload, /* --payload|--pay hello world! */
  77. opt_pcscf_ip, /* --pcscf-ip 192.168.0.13 */
  78. opt_pcscf_port, /* --pcscf-port 5060 */
  79. opt_pcscf_trans, /* --pcscf-trans udp */
  80. opt_realm, /* --realm open-ims.test */
  81. opt_sec, /* --sec 1800 */
  82. opt_sid, /* --sid 1234 */
  83. opt_sigcomp_id, /* --sigcomp-id urn:uuid:2e5fdc76-00be-4314-8202-1116fa82a473 */
  84. opt_silent, /* --silent */
  85. opt_smsc, /* --smsc +3315245856 */
  86. opt_stun_ip, /* --stun-ip numb.viagenie.ca */
  87. opt_stun_pwd, /* --stun-pwd mysecret */
  88. opt_stun_port, /* --stun-port 3478 */
  89. opt_stun_usr, /* --stun-usr bob@open-ims.test */
  90. opt_to, /* --to sip:alice@open-ims.test */
  91. }
  92. opt_type_t;
  93. typedef enum lv_e {
  94. lv_none,
  95. lv_stack, /* @@stack | @@st */
  96. lv_session, /* @@session | @@ss */
  97. lv_action /* @@action | @@request | @@a | @@r*/
  98. }
  99. lv_t;
  100. typedef struct opt_s {
  101. TSK_DECLARE_OBJECT;
  102. opt_type_t type;
  103. lv_t lv;
  104. char* value;
  105. }
  106. opt_t;
  107. typedef tsk_list_t opts_L_t;
  108. typedef struct cmd_s {
  109. TSK_DECLARE_OBJECT;
  110. cmd_type_t type;
  111. opts_L_t *opts;
  112. char* sidparam;
  113. }
  114. cmd_t;
  115. cmd_t* cmd_create(cmd_type_t );
  116. #define cmd_create_null() cmd_create(cmd_none)
  117. cmd_t* cmd_parse(const char* buffer, tsk_size_t size, tsk_bool_t *comment, tsk_params_L_t* params);
  118. void cmd_print_help();
  119. opt_t* opt_create(opt_type_t, lv_t, const char*);
  120. const opt_t* opt_get_by_type(const opts_L_t* , opt_type_t);
  121. #define opt_create_null() opt_create(opt_none, lv_none, tsk_null)
  122. const tsk_object_def_t *opt_def_t;
  123. const tsk_object_def_t *cmd_def_t;
  124. _END_DECLS
  125. #endif /* TINYDEMO_CMD_H */