Sipper 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/sipper/README.rb +26 -0
- data/sipper/b2bua_controller.rb +163 -0
- data/sipper/b2bua_session_mixin.rb +24 -0
- data/sipper/base_controller.rb +425 -0
- data/sipper/bin/common.rb +42 -0
- data/sipper/bin/generate.rb +70 -0
- data/sipper/bin/project.rb +44 -0
- data/sipper/bin/run.rb +85 -0
- data/sipper/bin/run_smoke.rb +8 -0
- data/sipper/config/log4r.xml +71 -0
- data/sipper/controller_class_loader.rb +29 -0
- data/sipper/controller_selector.rb +119 -0
- data/sipper/controllers/invite_controller.rb +30 -0
- data/sipper/controllers/order.yaml +3 -0
- data/sipper/custom_message.rb +4 -0
- data/sipper/detached_session.rb +11 -0
- data/sipper/docs/manual.txt +1621 -0
- data/sipper/generators/README +12 -0
- data/sipper/generators/gen_controller.rb +228 -0
- data/sipper/generators/gen_project.rb +45 -0
- data/sipper/generators/gen_test.rb +72 -0
- data/sipper/generators/project_template_dir/Rakefile +56 -0
- data/sipper/generators/project_template_dir/config/sipper.cfg +31 -0
- data/sipper/generators/project_template_dir/controllers/README.txt +2 -0
- data/sipper/generators/project_template_dir/dot_sipper.proj +2 -0
- data/sipper/generators/project_template_dir/logs/README.txt +2 -0
- data/sipper/generators/project_template_dir/tests/README.txt +2 -0
- data/sipper/lib/smc/statemap.rb +194 -0
- data/sipper/logs/dialog_info_store +0 -0
- data/sipper/logs/r.cmd +6 -0
- data/sipper/logs/r.sh +6 -0
- data/sipper/media/sipper_media_client.rb +268 -0
- data/sipper/media/sipper_media_event.rb +43 -0
- data/sipper/media/sipper_media_manager.rb +145 -0
- data/sipper/media/sipper_media_proxy.rb +60 -0
- data/sipper/media/sipper_offer_answer.rb +285 -0
- data/sipper/message.rb +512 -0
- data/sipper/modified_pattern_formatter.rb +119 -0
- data/sipper/proxy_controller.rb +143 -0
- data/sipper/registration.rb +52 -0
- data/sipper/request.rb +109 -0
- data/sipper/response.rb +123 -0
- data/sipper/ruby_ext/module.rb +27 -0
- data/sipper/ruby_ext/mutable_class.rb +17 -0
- data/sipper/ruby_ext/object.rb +38 -0
- data/sipper/ruby_ext/pqueue.rb +190 -0
- data/sipper/ruby_ext/snapshot.rb +201 -0
- data/sipper/ruby_ext/string.rb +18 -0
- data/sipper/ruby_ext/time.rb +9 -0
- data/sipper/run/run_sipper1.rb +28 -0
- data/sipper/run/run_sipper2.rb +56 -0
- data/sipper/sdp/sdp.rb +257 -0
- data/sipper/sdp/sdp_generator.rb +131 -0
- data/sipper/sdp/sdp_parser.rb +136 -0
- data/sipper/session.rb +1952 -0
- data/sipper/session_manager.rb +170 -0
- data/sipper/session_recorder.rb +190 -0
- data/sipper/session_state/DialogState.sm +54 -0
- data/sipper/session_state/DialogState_sm.rb +337 -0
- data/sipper/session_state/dialog_routes.rb +141 -0
- data/sipper/sip_headers/header.rb +632 -0
- data/sipper/sip_headers/sipuri.rb +352 -0
- data/sipper/sip_logger.rb +65 -0
- data/sipper/sip_message_router.rb +231 -0
- data/sipper/sip_test_driver_controller.rb +10 -0
- data/sipper/sipper.rb +329 -0
- data/sipper/sipper_assertions.rb +21 -0
- data/sipper/sipper_configurator.rb +376 -0
- data/sipper/sipper_http/sipper_http_request_dispatcher.rb +71 -0
- data/sipper/sipper_http/sipper_http_response.rb +25 -0
- data/sipper/stray_message_manager.rb +40 -0
- data/sipper/test_completion_signaling_helper.rb +77 -0
- data/sipper/transaction/Ict.sm +59 -0
- data/sipper/transaction/Ict_sm.rb +430 -0
- data/sipper/transaction/Ist.sm +74 -0
- data/sipper/transaction/Ist_sm.rb +460 -0
- data/sipper/transaction/Nict.sm +51 -0
- data/sipper/transaction/Nict_sm.rb +325 -0
- data/sipper/transaction/Nist.sm +59 -0
- data/sipper/transaction/Nist_sm.rb +356 -0
- data/sipper/transaction/invite_client_transaction.rb +274 -0
- data/sipper/transaction/invite_server_transaction.rb +319 -0
- data/sipper/transaction/non_invite_client_transaction.rb +230 -0
- data/sipper/transaction/non_invite_server_transaction.rb +263 -0
- data/sipper/transaction/state_machine_wrapper.rb +58 -0
- data/sipper/transaction/transaction.rb +212 -0
- data/sipper/transport/base_transport.rb +84 -0
- data/sipper/transport/rel_unrel.rb +19 -0
- data/sipper/transport/transport_and_route_resolver.rb +67 -0
- data/sipper/transport/udp_transport.rb +156 -0
- data/sipper/transport_manager.rb +33 -0
- data/sipper/udp_session.rb +17 -0
- data/sipper/util/command_element.rb +62 -0
- data/sipper/util/compact_converter.rb +50 -0
- data/sipper/util/counter.rb +26 -0
- data/sipper/util/digest/digest_authorizer.rb +204 -0
- data/sipper/util/expectation_parser.rb +164 -0
- data/sipper/util/locator.rb +31 -0
- data/sipper/util/message_fill.rb +58 -0
- data/sipper/util/persistence/ps_sipper_map.rb +63 -0
- data/sipper/util/persistence/sipper_map.rb +41 -0
- data/sipper/util/sipper_util.rb +305 -0
- data/sipper/util/timer/sip_timer_helper.rb +26 -0
- data/sipper/util/timer/timer_manager.rb +80 -0
- data/sipper/util/timer/timer_task.rb +56 -0
- data/sipper/util/validations.rb +44 -0
- data/sipper/version.rb +10 -0
- data/sipper_test/_test_media_uas.rb +79 -0
- data/sipper_test/base_test_case.rb +31 -0
- data/sipper_test/c_134.txt +7 -0
- data/sipper_test/driven_sip_test_case.rb +96 -0
- data/sipper_test/gold.txt +10 -0
- data/sipper_test/gold_res.txt +8 -0
- data/sipper_test/gold_sub.txt +9 -0
- data/sipper_test/hello_sipper.au +0 -0
- data/sipper_test/in_sipper.au +0 -0
- data/sipper_test/nonrr_proxy.rb +17 -0
- data/sipper_test/order_tests.yaml +4 -0
- data/sipper_test/rake_res.txt +399 -0
- data/sipper_test/rr_proxy.rb +17 -0
- data/sipper_test/run_test.cmd +94 -0
- data/sipper_test/sip_test_case.rb +104 -0
- data/sipper_test/test2xx_retransmission.rb +80 -0
- data/sipper_test/test2xx_retransmission_with_limit.rb +81 -0
- data/sipper_test/test2xx_retransmission_with_nist.rb +91 -0
- data/sipper_test/test2xx_retransmission_with_txns.rb +94 -0
- data/sipper_test/test_address_header.rb +66 -0
- data/sipper_test/test_b2bua1.rb +130 -0
- data/sipper_test/test_b2bua2.rb +120 -0
- data/sipper_test/test_b2bua3.rb +160 -0
- data/sipper_test/test_b2bua4.rb +130 -0
- data/sipper_test/test_base_controller.rb +110 -0
- data/sipper_test/test_base_transport.rb +37 -0
- data/sipper_test/test_cancel.rb +21 -0
- data/sipper_test/test_cancel_after2xx.rb +81 -0
- data/sipper_test/test_cancel_retransmission.rb +105 -0
- data/sipper_test/test_cancel_with481.rb +83 -0
- data/sipper_test/test_cancel_with487.rb +70 -0
- data/sipper_test/test_cancel_with_ist_without_nist.rb +99 -0
- data/sipper_test/test_cancel_with_nist.rb +84 -0
- data/sipper_test/test_cancel_without487.rb +77 -0
- data/sipper_test/test_command_element.rb +38 -0
- data/sipper_test/test_compact_converter.rb +33 -0
- data/sipper_test/test_controller_class_loader.rb +37 -0
- data/sipper_test/test_controller_selector.rb +53 -0
- data/sipper_test/test_controller_using_compact_headers.rb +74 -0
- data/sipper_test/test_controller_using_header_order.rb +85 -0
- data/sipper_test/test_controller_using_ict.rb +64 -0
- data/sipper_test/test_controller_using_ict_with_non_success.rb +72 -0
- data/sipper_test/test_controller_using_ict_with_tcbh.rb +24 -0
- data/sipper_test/test_controller_using_ict_with_tcbh_no_action.rb +24 -0
- data/sipper_test/test_controller_using_ist.rb +70 -0
- data/sipper_test/test_controller_using_ist_with_tcbh.rb +24 -0
- data/sipper_test/test_controller_using_nict.rb +115 -0
- data/sipper_test/test_controller_using_nict_with_tcbh.rb +24 -0
- data/sipper_test/test_controller_using_nist.rb +63 -0
- data/sipper_test/test_controller_using_pre_existing_rs0.rb +73 -0
- data/sipper_test/test_controller_using_pre_existing_rs1.rb +75 -0
- data/sipper_test/test_controller_using_pre_existing_rs2.rb +71 -0
- data/sipper_test/test_controller_using_route_set.rb +86 -0
- data/sipper_test/test_controller_with_sdp.rb +80 -0
- data/sipper_test/test_controllers/cancel/order.yaml +2 -0
- data/sipper_test/test_controllers/cancel/uac_cancel_controller.rb +35 -0
- data/sipper_test/test_controllers/cancel/uas_cancel_controller.rb +25 -0
- data/sipper_test/test_controllers/class_loading/ordered/first_ordered_controller.rb +5 -0
- data/sipper_test/test_controllers/class_loading/ordered/order.yaml +3 -0
- data/sipper_test/test_controllers/class_loading/ordered/recond_ordered_controller.rb +6 -0
- data/sipper_test/test_controllers/class_loading/ordered/second_ordered_controller.rb +6 -0
- data/sipper_test/test_controllers/class_loading/unordered/first_unordered_controller.rb +7 -0
- data/sipper_test/test_controllers/class_loading/unordered/second_unordered_controller.rb +6 -0
- data/sipper_test/test_controllers/ctrl_trhandler/lib/transport_filters/my_transport_handler.rb +22 -0
- data/sipper_test/test_controllers/ctrl_trhandler/uac_tr_handler_controller.rb +27 -0
- data/sipper_test/test_controllers/ctrl_trhandler/uas_tr_handler_controller.rb +21 -0
- data/sipper_test/test_controllers/ete/order.yaml +1 -0
- data/sipper_test/test_controllers/ete/uac_controller.rb +39 -0
- data/sipper_test/test_controllers/ete/uas_controller.rb +34 -0
- data/sipper_test/test_controllers/extensions/extension_uac_controller.rb +24 -0
- data/sipper_test/test_controllers/extensions/extension_uas_controller.rb +35 -0
- data/sipper_test/test_controllers/extensions/lib/sipper_extensions/my_from_extension.rb +16 -0
- data/sipper_test/test_controllers/ict_tcbh/lib/transaction_handlers/app_ict_handler.rb +23 -0
- data/sipper_test/test_controllers/ict_tcbh/uac_ict_tcbh_controller.rb +27 -0
- data/sipper_test/test_controllers/ict_tcbh/uac_ict_tcbh_no_action_controller.rb +28 -0
- data/sipper_test/test_controllers/ict_tcbh/uas_ict_tcbh_controller.rb +29 -0
- data/sipper_test/test_controllers/ict_tcbh/uas_ict_tcbh_no_action_controller.rb +31 -0
- data/sipper_test/test_controllers/ist_tcbh/lib/app_ist_handler.rb +13 -0
- data/sipper_test/test_controllers/ist_tcbh/uac_ist_tcbh_controller.rb +22 -0
- data/sipper_test/test_controllers/ist_tcbh/uas_ist_tcbh_controller.rb +31 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/in_order.yaml +2 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/my_transport_handler1.rb +21 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/my_transport_handler2.rb +21 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/out_order.yaml +2 -0
- data/sipper_test/test_controllers/multi_trhandlers/uac_multi_tr_handler_controller.rb +27 -0
- data/sipper_test/test_controllers/multi_trhandlers/uas_multi_tr_handler_controller.rb +29 -0
- data/sipper_test/test_controllers/multiple/lib/blank_test.rb +2 -0
- data/sipper_test/test_controllers/multiple/uac_info_controller.rb +21 -0
- data/sipper_test/test_controllers/multiple/uac_msg_controller.rb +20 -0
- data/sipper_test/test_controllers/multiple/uas_info_controller.rb +15 -0
- data/sipper_test/test_controllers/multiple/uas_msg_controller.rb +14 -0
- data/sipper_test/test_controllers/nict_tcbh/lib/transaction_handlers/app_nict_handler.rb +13 -0
- data/sipper_test/test_controllers/nict_tcbh/uac_nict_tcbh_controller.rb +26 -0
- data/sipper_test/test_controllers/nict_tcbh/uas_nict_tcbh_controller.rb +20 -0
- data/sipper_test/test_controllers/state_machine_based/lib/CreditControl.sm +43 -0
- data/sipper_test/test_controllers/state_machine_based/lib/CreditControl_sm.rb +194 -0
- data/sipper_test/test_controllers/state_machine_based/order.yaml +1 -0
- data/sipper_test/test_controllers/state_machine_based/uac_message_controller.rb +34 -0
- data/sipper_test/test_controllers/state_machine_based/uas_message_controller.rb +44 -0
- data/sipper_test/test_controllers/stray_message/lib/sipper_extensions/my_stray_handler.rb +9 -0
- data/sipper_test/test_controllers/stray_message/stray_uac_controller.rb +24 -0
- data/sipper_test/test_controllers/stray_message/stray_uas_controller.rb +31 -0
- data/sipper_test/test_controllers/string/order.yaml +1 -0
- data/sipper_test/test_controllers/string/uac_controller.rb +29 -0
- data/sipper_test/test_controllers/string/uas_controller.rb +22 -0
- data/sipper_test/test_controllers/test_controller.rb +24 -0
- data/sipper_test/test_detached_session1.rb +78 -0
- data/sipper_test/test_dialog_routes.rb +139 -0
- data/sipper_test/test_digest_challenge1.rb +89 -0
- data/sipper_test/test_digest_challenge2.rb +90 -0
- data/sipper_test/test_dynamic_parse.rb +249 -0
- data/sipper_test/test_empty_sdp.rb +89 -0
- data/sipper_test/test_ete.rb +37 -0
- data/sipper_test/test_expectation_parser.rb +76 -0
- data/sipper_test/test_extensions.rb +28 -0
- data/sipper_test/test_freeze.rb +81 -0
- data/sipper_test/test_generated.rb +90 -0
- data/sipper_test/test_header_parameters.rb +75 -0
- data/sipper_test/test_header_parse.rb +141 -0
- data/sipper_test/test_http_client1.rb +84 -0
- data/sipper_test/test_http_client2.rb +90 -0
- data/sipper_test/test_ict_with_timeout.rb +62 -0
- data/sipper_test/test_in_dialog_request.rb +61 -0
- data/sipper_test/test_inline_controller.rb +67 -0
- data/sipper_test/test_invite_client_transaction.rb +272 -0
- data/sipper_test/test_invite_replace.rb +147 -0
- data/sipper_test/test_invite_retransmission.rb +90 -0
- data/sipper_test/test_invite_server_transaction.rb +208 -0
- data/sipper_test/test_lower_cseq.rb +79 -0
- data/sipper_test/test_media.rb +52 -0
- data/sipper_test/test_message.rb +392 -0
- data/sipper_test/test_method_specific_response_handling.rb +81 -0
- data/sipper_test/test_multi_homed1.rb +127 -0
- data/sipper_test/test_multi_homed2.rb +109 -0
- data/sipper_test/test_multi_homed_duplicate.rb +87 -0
- data/sipper_test/test_multi_homed_with_detached.rb +88 -0
- data/sipper_test/test_multiple.rb +49 -0
- data/sipper_test/test_multiple_contacts.rb +89 -0
- data/sipper_test/test_non2xx_retransmission_with_ist.rb +87 -0
- data/sipper_test/test_non_invite_client_transaction.rb +210 -0
- data/sipper_test/test_non_invite_retransmission.rb +91 -0
- data/sipper_test/test_non_invite_server_transaction.rb +202 -0
- data/sipper_test/test_offer_answer_prack.rb +103 -0
- data/sipper_test/test_pickup.rb +258 -0
- data/sipper_test/test_prack.rb +105 -0
- data/sipper_test/test_prack_store_and_dispatch.rb +101 -0
- data/sipper_test/test_prack_timer.rb +105 -0
- data/sipper_test/test_ps_sipper_map.rb +56 -0
- data/sipper_test/test_re_invite_uas_ongoing_ict.rb +81 -0
- data/sipper_test/test_re_invite_uas_ongoing_ist.rb +84 -0
- data/sipper_test/test_re_invite_with_ongoing_ict.rb +101 -0
- data/sipper_test/test_re_invite_with_ongoing_ist.rb +89 -0
- data/sipper_test/test_recorder_swap.rb +157 -0
- data/sipper_test/test_refer.rb +121 -0
- data/sipper_test/test_registeration_clearing.rb +97 -0
- data/sipper_test/test_registrar.rb +109 -0
- data/sipper_test/test_registration_controller.rb +73 -0
- data/sipper_test/test_registration_timeout.rb +90 -0
- data/sipper_test/test_remote_controller.rb +39 -0
- data/sipper_test/test_remote_target_update_on2xx.rb +140 -0
- data/sipper_test/test_request.rb +106 -0
- data/sipper_test/test_response.rb +40 -0
- data/sipper_test/test_response_without_to_tag.rb +92 -0
- data/sipper_test/test_rport.rb +88 -0
- data/sipper_test/test_sdp.rb +91 -0
- data/sipper_test/test_sdp_parser.rb +145 -0
- data/sipper_test/test_session.rb +276 -0
- data/sipper_test/test_session_callback_handler.rb +68 -0
- data/sipper_test/test_session_lifetime.rb +66 -0
- data/sipper_test/test_session_manager.rb +141 -0
- data/sipper_test/test_session_recorder.rb +145 -0
- data/sipper_test/test_session_state_user_defined.rb +84 -0
- data/sipper_test/test_session_states.rb +91 -0
- data/sipper_test/test_simple_dialog_state.rb +86 -0
- data/sipper_test/test_simple_re_invite.rb +86 -0
- data/sipper_test/test_sip_uri.rb +234 -0
- data/sipper_test/test_sipper_util.rb +45 -0
- data/sipper_test/test_smc_controller.rb +17 -0
- data/sipper_test/test_smoke.rb +80 -0
- data/sipper_test/test_stray.rb +28 -0
- data/sipper_test/test_stray_inline.rb +89 -0
- data/sipper_test/test_stray_res_acked.rb +103 -0
- data/sipper_test/test_stray_respond.rb +104 -0
- data/sipper_test/test_stray_retry.rb +92 -0
- data/sipper_test/test_stray_retry_failure.rb +93 -0
- data/sipper_test/test_stray_retry_initial.rb +100 -0
- data/sipper_test/test_strict_router_with_angled.rb +84 -0
- data/sipper_test/test_string_record.rb +31 -0
- data/sipper_test/test_subscribe_notify.rb +141 -0
- data/sipper_test/test_subscribe_notify_client_timeout.rb +158 -0
- data/sipper_test/test_subscribe_notify_dialog.rb +146 -0
- data/sipper_test/test_subscribe_notify_expires.rb +155 -0
- data/sipper_test/test_subscribe_notify_multiple_subscription.rb +157 -0
- data/sipper_test/test_subscribe_notify_server_timeout.rb +144 -0
- data/sipper_test/test_subsequent_unsent.rb +88 -0
- data/sipper_test/test_target_refresh_proxy_detached.rb +128 -0
- data/sipper_test/test_target_refresh_proxy_udp.rb +130 -0
- data/sipper_test/test_target_refresh_rr_proxy_udp.rb +133 -0
- data/sipper_test/test_target_refresh_with_new_port.rb +158 -0
- data/sipper_test/test_target_refresh_with_proxy1.rb +113 -0
- data/sipper_test/test_target_refresh_with_rr_update_proxy.rb +145 -0
- data/sipper_test/test_target_refresh_with_update_proxy.rb +144 -0
- data/sipper_test/test_target_refresh_with_update_proxy2.rb +139 -0
- data/sipper_test/test_timer_manager.rb +71 -0
- data/sipper_test/test_timer_task.rb +60 -0
- data/sipper_test/test_transport_handler.rb +19 -0
- data/sipper_test/test_transport_multi_handler.rb +18 -0
- data/sipper_test/test_udp_transport.rb +119 -0
- data/sipper_test/test_unparsed.rb +70 -0
- data/sipper_test/test_validations.rb +69 -0
- data/sipper_test/test_with_rr_proxy.rb +111 -0
- data/sipper_test/testmediacontroller.rb +71 -0
- data/sipper_test/tracing.rb +23 -0
- data/sipper_test/transaction_test_helper.rb +176 -0
- data/sipper_test/transport_filters.rb +26 -0
- data/sipper_test/ts_sipper.rb +91 -0
- data/sipper_test/ts_smoke.rb +3 -0
- data/sipper_test/tt.cmd +20 -0
- metadata +455 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'sipper_configurator'
|
3
|
+
|
4
|
+
module SipperUtil
|
5
|
+
class Common
|
6
|
+
@@project_dir = nil
|
7
|
+
# Returns base proj dir if called from within a project directory.
|
8
|
+
def self.in_project_dir
|
9
|
+
unless @@project_dir
|
10
|
+
dir = FileUtils.pwd
|
11
|
+
try_files = [File.join(dir,".sipper.proj"), File.join(dir,"..",".sipper.proj"), File.join(dir,"..","..",".sipper.proj")]
|
12
|
+
try_files.each_with_index do |f,i|
|
13
|
+
if File.exist? f
|
14
|
+
pd = case i
|
15
|
+
when 0
|
16
|
+
dir
|
17
|
+
when 1
|
18
|
+
File.join(dir,"..")
|
19
|
+
when 2
|
20
|
+
File.join(dir,"..","..")
|
21
|
+
end
|
22
|
+
@@project_dir = pd
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
return @@project_dir
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.set_environment
|
30
|
+
dir = SipperUtil::Common.in_project_dir()
|
31
|
+
if dir
|
32
|
+
cf = File.join(dir, "config", "sipper.cfg")
|
33
|
+
SipperConfigurator.load_yaml_file(cf) if File.exist? cf
|
34
|
+
end
|
35
|
+
dir
|
36
|
+
end
|
37
|
+
|
38
|
+
end # class
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
end # module
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# todo let gems create an executable that can run this from anywhere.
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__),"..")
|
4
|
+
|
5
|
+
require 'sipper_configurator'
|
6
|
+
require 'bin/common'
|
7
|
+
|
8
|
+
dir = SipperUtil::Common.set_environment()
|
9
|
+
|
10
|
+
require "generators/gen_controller"
|
11
|
+
require "generators/gen_test"
|
12
|
+
|
13
|
+
Signal.trap("INT") { puts; exit }
|
14
|
+
|
15
|
+
|
16
|
+
require File.dirname(__FILE__) + '/../version'
|
17
|
+
|
18
|
+
|
19
|
+
def __print_usage
|
20
|
+
puts "Options: --version | -v => print version information"
|
21
|
+
puts " --help | -h => print this message"
|
22
|
+
puts " -c|-t [-r] <class_name> <flow_str>"
|
23
|
+
puts " => -c for controller and -t for test generation"
|
24
|
+
puts " => -r to optionally generate the reverse or opposite"
|
25
|
+
puts " flow from flow_str."
|
26
|
+
puts " i.e if flow indicates UAS then generate a UAC etc."
|
27
|
+
puts " => <class_name> is the name of class to be generated, "
|
28
|
+
puts " controller or test."
|
29
|
+
puts " => <flow_str> is the actual call flow."
|
30
|
+
puts " e.g. '< INVITE, > 100, > 200 {2,7}, < ACK'"
|
31
|
+
exit(0)
|
32
|
+
end
|
33
|
+
|
34
|
+
if %w(--version -v).include? ARGV.first
|
35
|
+
puts "generate #{SIP::VERSION::STRING}"
|
36
|
+
exit(0)
|
37
|
+
end
|
38
|
+
|
39
|
+
if ((ARGV.length < 3) || %w(--help -h).include?(ARGV.first) || !(%w(-t -c).include?(ARGV.first)))
|
40
|
+
__print_usage
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
type = ARGV.shift
|
45
|
+
reverse = false
|
46
|
+
if ARGV.first == "-r"
|
47
|
+
reverse = true
|
48
|
+
ARGV.shift
|
49
|
+
end
|
50
|
+
|
51
|
+
gcls = ARGV.shift # class name
|
52
|
+
flow = ARGV.shift.dup
|
53
|
+
|
54
|
+
unless gcls && flow
|
55
|
+
__print_usage
|
56
|
+
end
|
57
|
+
|
58
|
+
if reverse
|
59
|
+
flow.gsub!("<", "~").gsub!(">", "<").gsub!("~", ">")
|
60
|
+
end
|
61
|
+
|
62
|
+
if type == "-c"
|
63
|
+
g = SIP::Generators::GenController.new(gcls, flow)
|
64
|
+
g.generate_controller(true, dir.nil? ? nil : File.join(dir, "controllers") )
|
65
|
+
elsif type == "-t"
|
66
|
+
g = SIP::Generators::GenTest.new(gcls, flow)
|
67
|
+
g.generate_test(true, dir.nil? ? nil : File.join(dir, "tests"))
|
68
|
+
else
|
69
|
+
__print_usage
|
70
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "generators", "gen_project")
|
3
|
+
|
4
|
+
Signal.trap("INT") { puts; exit }
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + '/../version'
|
7
|
+
|
8
|
+
|
9
|
+
def __print_usage
|
10
|
+
usage = <<-EOF
|
11
|
+
Usage : sproj [-f] <name_of_project>
|
12
|
+
This command creates a new directory by the name 'name_of_project'
|
13
|
+
and creates a directory structure under it for the project.
|
14
|
+
The only optional argument is -f to force create the project directory.
|
15
|
+
Please see user manual for details of the directory structure.
|
16
|
+
EOF
|
17
|
+
puts usage
|
18
|
+
exit(0)
|
19
|
+
end
|
20
|
+
|
21
|
+
if %w(--version -v).include? ARGV.first
|
22
|
+
puts "generate #{SIP::VERSION::STRING}"
|
23
|
+
exit(0)
|
24
|
+
end
|
25
|
+
|
26
|
+
if ((ARGV.length > 2) || (ARGV.length == 0) || %w(--help -h).include?(ARGV.first) )
|
27
|
+
__print_usage
|
28
|
+
end
|
29
|
+
|
30
|
+
if "-f".include?(ARGV.first)
|
31
|
+
ARGV.shift
|
32
|
+
flag = true
|
33
|
+
else
|
34
|
+
flag = false
|
35
|
+
end
|
36
|
+
|
37
|
+
name = ARGV.shift
|
38
|
+
|
39
|
+
begin
|
40
|
+
SIP::Generators::GenProject.new(name, flag)
|
41
|
+
#rescue
|
42
|
+
# __print_usage
|
43
|
+
# raise
|
44
|
+
end
|
data/sipper/bin/run.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# todo let gems create an executable that can run this from anywhere.
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__),"..")
|
5
|
+
|
6
|
+
require 'sipper_configurator'
|
7
|
+
|
8
|
+
#Signal.trap("INT") { puts; exit }
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + '/../version'
|
11
|
+
def __print_usage
|
12
|
+
puts " --version | -v => print version information"
|
13
|
+
puts " --help | -h => print this message"
|
14
|
+
puts ""
|
15
|
+
puts " [-i <local_ip>] [-p <local_port>] [-r <remote_ip>] [-o remote_port>] [-c|-t <file_name>]"
|
16
|
+
puts " => -c for controller and -t for test generation"
|
17
|
+
puts " => <file_name> is the name of test or controller class to be run."
|
18
|
+
puts " The default local port while running the controller is 5060 and the default remote port is "
|
19
|
+
puts " also 5060. While running the test the default local port is 5066, remote is 5060"
|
20
|
+
puts " In its simplest usage, you can just start sipper by running it "
|
21
|
+
puts " without arguments. The controllers in this case are loaded from "
|
22
|
+
puts " the default controller path location. "
|
23
|
+
exit(0)
|
24
|
+
end
|
25
|
+
|
26
|
+
if %w(--help -h).include?(ARGV.first)
|
27
|
+
__print_usage
|
28
|
+
end
|
29
|
+
|
30
|
+
if %w(--version -v).include? ARGV.first
|
31
|
+
puts "sipper #{SIP::VERSION::STRING}"
|
32
|
+
exit(0)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
if ARGV.length == 0
|
40
|
+
require 'bin/common'
|
41
|
+
require File.join(File.dirname(__FILE__), "..", "run", "run_sipper1")
|
42
|
+
RunSipper1.new.run
|
43
|
+
else
|
44
|
+
# [-i <local_ip>] [-p <local_port>] [-r <remote_ip>] [-o remote_port>] [-c|-t <file_name>]"
|
45
|
+
# Adding a bitwise mask to remember what was sent by commandline
|
46
|
+
# lip lp rip rp (8 4 2 1)
|
47
|
+
p = nil
|
48
|
+
ARGV.each_with_index do |arg, i|
|
49
|
+
if arg == "-m"
|
50
|
+
SipperConfigurator[:SipperMediaDefaultControlPort] = Integer(ARGV[i+1])
|
51
|
+
elsif arg == "-i"
|
52
|
+
SipperConfigurator[:LocalSipperIP] = ARGV[i+1]
|
53
|
+
SipperConfigurator[:CommandlineBitmask] |= 8
|
54
|
+
elsif arg == "-p"
|
55
|
+
p = SipperConfigurator[:LocalSipperPort] = Integer(ARGV[i+1])
|
56
|
+
SipperConfigurator[:CommandlineBitmask] |= 4
|
57
|
+
elsif arg == "-r"
|
58
|
+
SipperConfigurator[:DefaultRIP] = ARGV[i+1]
|
59
|
+
SipperConfigurator[:CommandlineBitmask] |= 2
|
60
|
+
elsif arg == "-o"
|
61
|
+
SipperConfigurator[:DefaultRP] = Integer(ARGV[i+1])
|
62
|
+
SipperConfigurator[:CommandlineBitmask] |= 1
|
63
|
+
elsif arg == "-rf"
|
64
|
+
SipperConfigurator[:SipperRunFor] = Integer(ARGV[i+1])
|
65
|
+
elsif arg == "-t"
|
66
|
+
SipperConfigurator[:LocalTestPort] = p if p
|
67
|
+
f = ARGV[i+1]
|
68
|
+
unless $ULOGNAME
|
69
|
+
$ULOGNAME = '_'+File.basename(f)[0...-3]
|
70
|
+
end
|
71
|
+
ARGV.clear # clear the args
|
72
|
+
require 'bin/common'
|
73
|
+
load f
|
74
|
+
elsif arg == "-c"
|
75
|
+
unless $ULOGNAME
|
76
|
+
$ULOGNAME = '_' + File.basename(ARGV[i+1])[0...-3]
|
77
|
+
end
|
78
|
+
require 'bin/common'
|
79
|
+
require File.join(File.dirname(__FILE__), "..", "run", "run_sipper1")
|
80
|
+
r = RunSipper1.new(ARGV[i+1])
|
81
|
+
r.run
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<log4r_config>
|
2
|
+
<pre_config>
|
3
|
+
<global level="DEBUG"/>
|
4
|
+
</pre_config>
|
5
|
+
|
6
|
+
<!-- Outputters -->
|
7
|
+
|
8
|
+
<outputter name="sipout" type="FileOutputter" level="DEBUG">
|
9
|
+
<filename>#{logpath}/#{pid}_sipper.log</filename>
|
10
|
+
<formatter name="aformat" type="PatternFormatter" pattern="[%l]:[%d]:[%h]:%C :: %m">
|
11
|
+
<date_method>to_f</date_method>
|
12
|
+
</formatter>
|
13
|
+
</outputter>
|
14
|
+
|
15
|
+
<outputter name="sipmsgtrace" type="FileOutputter" level="DEBUG">
|
16
|
+
<filename>#{logpath}/#{pid}#{udfname}_sipmsgtrace.log</filename>
|
17
|
+
<formatter name="aformat" type="PatternFormatter" pattern="[%d]:[%h]:: %m">
|
18
|
+
<date_method>to_f</date_method>
|
19
|
+
</formatter>
|
20
|
+
</outputter>
|
21
|
+
|
22
|
+
|
23
|
+
<!-- Spit any errors to the console. They merit special attention -->
|
24
|
+
<outputter name="console" type="StderrOutputter" level="FATAL"/>
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
<!-- Loggers -->
|
29
|
+
|
30
|
+
<logger name="siplog" level="DEBUG" additive="false" trace="true">
|
31
|
+
<outputters>sipout, console</outputters>
|
32
|
+
</logger>
|
33
|
+
|
34
|
+
<logger name="siplog::transport_udptransport" level="DEBUG" additive="true" trace="true"/>
|
35
|
+
<logger name="siplog::request" level="DEBUG" additive="true" trace="false"/>
|
36
|
+
<logger name="siplog::message" level="DEBUG" additive="true" trace="true"/>
|
37
|
+
<logger name="siplog::response" level="DEBUG" additive="true" trace="true"/>
|
38
|
+
<logger name="siplog::session" level="DEBUG" additive="true" trace="true"/>
|
39
|
+
<logger name="siplog::messagefill" level="DEBUG" additive="true" trace="true"/>
|
40
|
+
<logger name="siplog::sipmessagerouter" level="DEBUG" additive="true" trace="false"/>
|
41
|
+
<logger name="siplog::sessionmanager" level="DEBUG" additive="true" trace="false"/>
|
42
|
+
<logger name="siplog::sip_sipper" level="DEBUG" additive="true" trace="false"/>
|
43
|
+
<logger name="siplog::udpsession" level="DEBUG" additive="true" trace="false"/>
|
44
|
+
<logger name="siplog::detachedsession" level="DEBUG" additive="true" trace="false"/>
|
45
|
+
<logger name="siplog::udpsessionwrapper" level="DEBUG" additive="true" trace="false"/>
|
46
|
+
<logger name="siplog::sip_basecontroller" level="DEBUG" additive="true" trace="false"/>
|
47
|
+
<logger name="siplog::sip_controllerselector" level="DEBUG" additive="true" trace="false"/>
|
48
|
+
<logger name="siplog::sessionrecorder" level="DEBUG" additive="true" trace="false"/>
|
49
|
+
<logger name="siplog::sipperconfigurator" level="DEBUG" additive="true" trace="false"/>
|
50
|
+
<logger name="siplog::sip_controllerclassloader" level="DEBUG" additive="true" trace="false"/>
|
51
|
+
<logger name="siplog::sip_testcompletionsignalinghelper" level="DEBUG" additive="true" trace="false"/>
|
52
|
+
<logger name="siplog::sip_timermanager" level="DEBUG" additive="true" trace="false"/>
|
53
|
+
<logger name="siplog::sip_transaction_inviteclienttransaction" level="DEBUG" additive="true" trace="false"/>
|
54
|
+
<logger name="siplog::sip_transaction_inviteservertransaction" level="DEBUG" additive="true" trace="false"/>
|
55
|
+
<logger name="siplog::sip_transaction_noninviteservertransaction" level="DEBUG" additive="true" trace="false"/>
|
56
|
+
<logger name="siplog::sip_transaction_noninviteclienttransaction" level="DEBUG" additive="true" trace="false"/>
|
57
|
+
<logger name="siplog::sipperutil_expectationelement" level="DEBUG" additive="true" trace="false"/>
|
58
|
+
<logger name="siplog::sipperutil_commandelement" level="DEBUG" additive="true" trace="false"/>
|
59
|
+
<logger name="siplog::sipheaders_header" level="DEBUG" additive="true" trace="false"/>
|
60
|
+
<logger name="siplog::media_sippermediaproxy" level="DEBUG" additive="true" trace="false"/>
|
61
|
+
<logger name="siplog::media_sippermediamanager" level="DEBUG" additive="true" trace="false"/>
|
62
|
+
<logger name="siplog::media_sippermediaclient" level="DEBUG" additive="true" trace="false"/>
|
63
|
+
<logger name="siplog::media_sipperofferanswer" level="DEBUG" additive="true" trace="false"/>
|
64
|
+
<logger name="siplog::media_sipperdummymediaclient" level="DEBUG" additive="true" trace="false"/>
|
65
|
+
<logger name="siplog::sipperhttprequestdispatcher" level="DEBUG" additive="true" trace="false"/>
|
66
|
+
|
67
|
+
<logger name="sipmsgtracelog" level="DEBUG" additive="false" trace="true">
|
68
|
+
<outputters>sipmsgtrace</outputters>
|
69
|
+
</logger>
|
70
|
+
|
71
|
+
</log4r_config>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'sip_logger'
|
2
|
+
require 'ruby_ext/string'
|
3
|
+
|
4
|
+
module SIP
|
5
|
+
class ControllerClassLoader
|
6
|
+
|
7
|
+
@@class_constants = []
|
8
|
+
|
9
|
+
def self.clear_all
|
10
|
+
@@class_constants = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.load fpath
|
14
|
+
str = IO.read(fpath)
|
15
|
+
load_from_string(str)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.load_from_string(str)
|
19
|
+
@@class_constants += str.all_class_names.select {|x| x=~ /Controller/} # re-opened string in ruby_ext
|
20
|
+
Object.module_eval(str) # load it in top level too. (could also be Kernel.load(path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.controllers
|
24
|
+
SipLogger['siplog::sip_controllerclassloader'].debug("Controllers now are #{@@class_constants.uniq.join(',')} ")
|
25
|
+
@@class_constants.uniq
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# If the order.yaml does not have any controller then
|
2
|
+
# the cotrollers defined in the controllers directory are taken
|
3
|
+
# in the alphabetical order, otherwise the order defined in
|
4
|
+
# the yaml is taken for the ones present, the rest are arranged alphabetically.
|
5
|
+
# There can be an optional block in the yaml file which is invoked to see
|
6
|
+
# if the controller should be invoked or not. Much like a rules engine.
|
7
|
+
# If the controller doesnt want to handle a request, it returns false, true otherwise.
|
8
|
+
# Data structure to check for on request
|
9
|
+
# - [[fname, <controller_instance>, <block/proc>],..] ordered by order in yaml and then alphabetical
|
10
|
+
# Iteration-1 only ordered instance array, later add block
|
11
|
+
|
12
|
+
require 'request'
|
13
|
+
require 'yaml'
|
14
|
+
require 'sip_logger'
|
15
|
+
require 'util/sipper_util'
|
16
|
+
require 'controller_class_loader'
|
17
|
+
|
18
|
+
module SIP
|
19
|
+
class ControllerSelector
|
20
|
+
include SipLogger
|
21
|
+
include SipperUtil
|
22
|
+
|
23
|
+
# this goes off and creates the controlllers and maintain
|
24
|
+
# the order map
|
25
|
+
def initialize dir
|
26
|
+
@controllers = {} # fqname=> instance
|
27
|
+
@load_dir = dir
|
28
|
+
load_controllers dir if @load_dir
|
29
|
+
end
|
30
|
+
|
31
|
+
# Load all or a defined controller
|
32
|
+
# todo code to load a named controller
|
33
|
+
def load_controllers(dir=@load_dir, controller=nil)
|
34
|
+
dir = Dir.new(dir) unless dir.class <= Dir
|
35
|
+
order_arr = nil
|
36
|
+
dir.each do |f|
|
37
|
+
next if File.directory?(f)
|
38
|
+
path = File.join(dir.path, f)
|
39
|
+
logd("Path is #{path}")
|
40
|
+
if f=~/order.yaml/
|
41
|
+
@order_arr = SipperUtil.load_yaml(path)
|
42
|
+
elsif f=~/controller.rb$/
|
43
|
+
SIP::ControllerClassLoader.load( path )
|
44
|
+
end
|
45
|
+
end
|
46
|
+
create_controllers
|
47
|
+
logd("There are a total of #{@controllers.size} controllers, they are #{@controllers.keys.join(',')}")
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def load_controller_from_string(str)
|
52
|
+
existing_controllers = SIP::ControllerClassLoader.controllers
|
53
|
+
SIP::ControllerClassLoader.load_from_string(str)
|
54
|
+
new_controllers = SIP::ControllerClassLoader.controllers - existing_controllers
|
55
|
+
name = nil
|
56
|
+
new_controllers.each do |fqcname|
|
57
|
+
create_controller( fqcname )
|
58
|
+
name = fqcname
|
59
|
+
end
|
60
|
+
name
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_controllers(request=nil)
|
64
|
+
if @order_arr
|
65
|
+
logd("order_arr present with #{@order_arr.join(',')}")
|
66
|
+
control_order = @controllers.sort do |x,y|
|
67
|
+
# todo DRY it when you have tests
|
68
|
+
(@order_arr.index(x[0])?@order_arr.index(x[0]):@order_arr.length) <=> (@order_arr.index(y[0])?@order_arr.index(y[0]):@order_arr.length)
|
69
|
+
end
|
70
|
+
else
|
71
|
+
control_order = @controllers.sort
|
72
|
+
end
|
73
|
+
control_order.map {|x| x[1]}
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_controller(name)
|
77
|
+
@controllers[name]
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
def clear_all
|
82
|
+
@controllers = {}
|
83
|
+
@order_arr = nil
|
84
|
+
SIP::ControllerClassLoader.clear_all
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
def create_controllers
|
90
|
+
logd("Loading controller from ControllerClassFinder")
|
91
|
+
SIP::ControllerClassLoader.controllers.each do |fqcname|
|
92
|
+
create_controller(fqcname)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_controller(fqcname)
|
97
|
+
m = SipperUtil.constantize(fqcname)
|
98
|
+
if m.class == Class
|
99
|
+
@controllers[fqcname] = inst = m.new
|
100
|
+
if inst.order >= 0
|
101
|
+
if @order_arr
|
102
|
+
@order_arr.insert([inst.order, @order_arr.length].min, fqcname)
|
103
|
+
else
|
104
|
+
@order_arr = [fqcname]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
private :create_controllers
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
if $PROGRAM_NAME == __FILE__
|
116
|
+
cs = SIP::ControllerSelector.new(Dir.new(File.join(SipperConfigurator[:SipperBasePath], "sipper", "controllers")))
|
117
|
+
ctr = cs.get_controllers(nil)
|
118
|
+
ctr.each {|x| p x.name}
|
119
|
+
end
|