diff --git a/Freeswitch.sln b/Freeswitch.sln index a2ac5e6387..41d46cb797 100644 --- a/Freeswitch.sln +++ b/Freeswitch.sln @@ -3,22 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "w32\Console\FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} - {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9} {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} + {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9} + {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} + {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750} + {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g729", "src\mod\codecs\mod_g729\mod_g729.vcproj", "{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}" @@ -28,42 +26,34 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g729", "src\mod\codecs\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsm", "src\mod\codecs\mod_gsm\mod_gsm.vcproj", "{4926323F-4EA8-4B7D-A3D3-65488725988F}" ProjectSection(ProjectDependencies) = postProject - {8FD2E297-4096-47E5-9258-C48FF1841523} = {8FD2E297-4096-47E5-9258-C48FF1841523} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {8FD2E297-4096-47E5-9258-C48FF1841523} = {8FD2E297-4096-47E5-9258-C48FF1841523} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xmpp_event", "src\mod\event_handlers\mod_xmpp_event\mod_xmpp_event.vcproj", "{F10BE67C-A8FF-4CB2-AF29-D46D2590DC59}" ProjectSection(ProjectDependencies) = postProject - {E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sndfile", "src\mod\formats\mod_sndfile\mod_sndfile.vcproj", "{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_bridgecall", "src\mod\applications\mod_bridgecall\mod_bridgecall.vcproj", "{E1794405-29D4-466D-9BE3-DD2344C2A663}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_test", "src\mod\event_handlers\mod_event_test\mod_event_test.vcproj", "{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g711", "src\mod\codecs\mod_g711\mod_g711.vcproj", "{B1FE4613-3F4B-4DAF-9714-2472BF8F56AE}" @@ -73,28 +63,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g711", "src\mod\codecs\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E} = {5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E} = {5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_playback", "src\mod\applications\mod_playback\mod_playback.vcproj", "{78100236-7CEA-4948-96CC-E8ED3160329C}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_l16", "src\mod\codecs\mod_l16\mod_l16.vcproj", "{5844AFE1-AA3E-4BDB-A9EF-119AEF19DF88}" @@ -104,24 +88,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_l16", "src\mod\codecs\m EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_softtimer", "src\mod\timers\mod_softtimer\mod_softtimer.vcproj", "{DCC13474-28DF-47CA-A8EB-72F8CE9A78C5}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speex", "src\mod\codecs\mod_speex\mod_speex.vcproj", "{5580D60E-0F77-4716-9CD4-B8E5986FA375}" ProjectSection(ProjectDependencies) = postProject - {1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_woomera", "src\mod\endpoints\mod_woomera\mod_woomera.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Codecs", "Codecs", "{F881ADA2-2F1A-4046-9FEB-191D9422D781}" @@ -144,19 +124,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "docs", "docs\docs.vcproj", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_xml", "src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.vcproj", "{07113B25-D3AF-4E04-BA77-4CD1171F022C}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ivrtest", "src\mod\applications\mod_ivrtest\mod_ivrtest.vcproj", "{419AA391-5F3F-4BFE-A869-9D154D62A792}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "FreeSwitchSetup", "w32\Setup\Setup.vdproj", "{B17FFBE6-A942-4056-8346-B624FB5D995B}" @@ -170,28 +145,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ldap", "src\mod\directo EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_directory", "src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.vcproj", "{A27CCA23-1541-4337-81A4-F0A6413078A0}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_zeroconf", "src\mod\event_handlers\mod_zeroconf\mod_zeroconf.vcproj", "{C7705DC4-2088-493E-AF8D-65BC6D65C125}" ProjectSection(ProjectDependencies) = postProject - {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_multicast", "src\mod\event_handlers\mod_event_multicast\mod_event_multicast.vcproj", "{784113EF-44D9-4949-835D-7065D3C7AD08}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libteletone", "libs\libteletone\libteletone.vcproj", "{89385C74-5860-4174-9CAF-A39E7C48909C}" @@ -200,14 +169,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Languages", "Languages", "{ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey", "src\mod\languages\mod_spidermonkey\mod_spidermonkey.vcproj", "{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}" ProjectSection(ProjectDependencies) = postProject - {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ASR-TTS", "ASR-TTS", "{4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}" @@ -229,36 +194,28 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_perl", "src\mod\languag EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_echo", "src\mod\applications\mod_echo\mod_echo.vcproj", "{0E2C6395-13B9-46E5-9264-8859D346018D}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.vcproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}" ProjectSection(ProjectDependencies) = postProject - {989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.vcproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}" ProjectSection(ProjectDependencies) = postProject - {E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {1906D736-08BD-4EE1-924F-B536249B9A54} = {1906D736-08BD-4EE1-924F-B536249B9A54} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_commands", "src\mod\applications\mod_commands\mod_commands.vcproj", "{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Loggers", "Loggers", "{A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}" @@ -272,58 +229,42 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XML Interfaces", "XML Inter EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.vcproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F} - {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1} - {356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94} + {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588} + {155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.vcproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "src\mod\applications\mod_conference\mod_conference.vcproj", "{C24FB505-05D7-4319-8485-7540B44C8603}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\applications\mod_dptools\mod_dptools.vcproj", "{B5881A85-FE70-4F64-8607-2CAAE52669C6}" ProjectSection(ProjectDependencies) = postProject - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_socket", "src\mod\event_handlers\mod_event_socket\mod_event_socket.vcproj", "{05515420-16DE-4E63-BE73-85BE85BA5142}" ProjectSection(ProjectDependencies) = postProject - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_cdr", "src\mod\event_handlers\mod_cdr\mod_cdr.vcproj", "{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Libraries", "_Libraries", "{EB910B0D-F27D-4B62-B67B-DE834C99AC5B}" @@ -336,6 +277,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libiax2", "libs\iax\libiax2 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}" ProjectSection(ProjectDependencies) = postProject + {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3} EndProjectSection EndProject @@ -361,8 +303,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapriconv", "libs\win32\a EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\apr-util\libaprutil.vcproj", "{F057DA7F-79E5-4B00-845C-EF446EF055E3}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Downloads", "_Downloads", "{C120A020-773F-4EA3-923F-B67AF28B750D}" @@ -380,8 +322,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "howl static library", "libs EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mDNSResponder static library", "libs\win32\howl\libmDNSResponder.vcproj", "{49C34584-B6DA-448F-83CF-27584DC9FC90}" ProjectSection(ProjectDependencies) = postProject - {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} {5927104D-C14C-4AC8-925C-4AB681762E75} = {5927104D-C14C-4AC8-925C-4AB681762E75} + {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsndfile", "libs\win32\libsndfile\libsndfile.vcproj", "{3D0370CA-BED2-4657-A475-32375CBCB6E4}" @@ -401,49 +343,40 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js", "libs\win32\js\js.vcpr EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.vcproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libg726", "libs\codec\g726\libg726.vcproj", "{5A6A281A-AA50-470A-8305-202BDA1CD1BF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g726", "src\mod\codecs\mod_g726\mod_g726.vcproj", "{486369EB-F150-4B56-BCC8-77B9E18FF5F5}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {5A6A281A-AA50-470A-8305-202BDA1CD1BF} = {5A6A281A-AA50-470A-8305-202BDA1CD1BF} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libg7xx", "libs\codec\g7xx\libg7xx.vcproj", "{D71E7338-8D9C-4FE4-A15F-D5CC60202C7C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g722", "src\mod\codecs\mod_g722\mod_g722.vcproj", "{D42518CC-7475-454D-B392-0E132C07D761}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {D71E7338-8D9C-4FE4-A15F-D5CC60202C7C} = {D71E7338-8D9C-4FE4-A15F-D5CC60202C7C} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_park", "src\mod\applications\mod_park\mod_park.vcproj", "{2740F45C-475A-4DE0-BCED-6E2E5F6C4B8B}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.vcproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}" ProjectSection(ProjectDependencies) = postProject - {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PTHREAD", "libs\win32\Download PTHREAD.vcproj", "{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}" @@ -455,82 +388,67 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "libs\win32\pthre EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g723_1", "src\mod\codecs\mod_g723_1\mod_g723_1.vcproj", "{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_native_file", "src\mod\formats\mod_native_file\mod_native_file.vcproj", "{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}" ProjectSection(ProjectDependencies) = postProject - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.NET", "src\dotnet\FreeSwitch.NET.csproj", "{251CAABC-16C3-4593-A491-603B908094E0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}" ProjectSection(ProjectDependencies) = postProject - {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}" ProjectSection(ProjectDependencies) = postProject - {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.vcproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} - {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8} - {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_etpan", "src\mod\languages\mod_spidermonkey_etpan\mod_spidermonkey_etpan.vcproj", "{D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}" ProjectSection(ProjectDependencies) = postProject - {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} = {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} = {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}" ProjectSection(ProjectDependencies) = postProject - {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libetpan", "libs\win32\etpan\libetpan.vcproj", "{BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_curl", "src\mod\xml_int\mod_xml_curl\mod_xml_curl.vcproj", "{AB91A099-7690-4ECF-8994-E458F4EA1ED4}" ProjectSection(ProjectDependencies) = postProject - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} - {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED} {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject @@ -538,17 +456,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "say", "say", "{6CD61A1D-797 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_en", "src\mod\say\mod_say_en\mod_say_en.vcproj", "{988CACF7-3FCB-4992-BE69-77872AE67DC8}" ProjectSection(ProjectDependencies) = postProject - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "libs\portaudio\build\msvc\portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_cdr", "src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.vcproj", "{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}" ProjectSection(ProjectDependencies) = postProject - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_amr", "src\mod\codecs\mod_amr\mod_amr.vcproj", "{8DEB383C-4091-4F42-A56F-C9E46D552D79}" @@ -826,17 +743,17 @@ Global {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.ActiveCfg = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.Build.0 = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|Win32 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug DLL|Win32 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug DLL|Win32 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug|Win32 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|Win32 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release DLL|Win32 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release DLL|Win32 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release|Win32 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|Win32 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug DLL|Win32 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug DLL|Win32 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|Win32 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release DLL|Win32 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release DLL|Win32 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release|Win32 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32 diff --git a/Makefile.am b/Makefile.am index c58a0f9395..c875c841a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,82 +4,46 @@ AUTOMAKE_OPTS = gnu foreign NAME=freeswitch PREFIX=$(prefix) -AM_CFLAGS = $(new_AM_CFLAGS) +AM_CFLAGS = $(new_AM_CFLAGS) AM_CPPFLAGS = $(AM_CFLAGS) -AM_LDFLAGS = $(new_AM_LDFLAGS) - -APR_CONFIG=$(prefix)/bin/apr-1-config -APU_CONFIG=$(prefix)/bin/apu-1-config -AM_CFLAGS += -I$(PREFIX)/include $(shell $(APR_CONFIG) --cflags --cppflags --includes) -I${prefix}/include/srtp -AM_LDFLAGS += -L$(PREFIX)/lib -AM_LDFLAGS += $(shell $(APR_CONFIG) --link-ld --libs ) -AM_CFLAGS += $(shell $(APU_CONFIG) --includes) -AM_LDFLAGS += $(shell $(APU_CONFIG) --link-ld --libs ) -AM_LDFLAGS += -lm -L/usr/local/lib/db42 -L/usr/local/lib -AM_LDFLAGS += -lsqlite3 -lpcre +AM_LDFLAGS = $(new_AM_LDFLAGS) +BASE = $(PWD) OSARCH=$(shell uname -s) +LIBTOOL=$(PWD)/libtool +LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) + +FIRST_INCLUDES = -I$(PWD)/src/include -I$(PWD) +AM_CFLAGS += $(FIRST_INCLUDES) -I$(PREFIX)/include + +AM_LDFLAGS += -L$(PREFIX)/lib +AM_LDFLAGS += -lm -L/usr/local/lib/db42 -L/usr/local/lib if CRASHPROT AM_CFLAGS += -DCRASH_PROT endif -AM_CFLAGS +=-I$(PWD)/src/sqlite -I$(PWD) -I$(PWD)/src/include -I$(PREFIX)/include -AM_CFLAGS += -DSWITCH_MOD_DIR=\"$(PREFIX)/mod\" -AM_CFLAGS += -DSWITCH_PREFIX_DIR=\"$(PREFIX)\" -AM_CFLAGS += -DSWITCH_CONF_DIR=\"$(PREFIX)/conf\" -AM_CFLAGS += -DSWITCH_DB_DIR=\"$(PREFIX)/db\" -AM_CFLAGS += -DSWITCH_LOG_DIR=\"$(PREFIX)/log\" -AM_CFLAGS += -DSWITCH_SCRIPT_DIR=\"$(PREFIX)/scripts\" -AM_CFLAGS += -DSWITCH_HTDOCS_DIR=\"$(PREFIX)/htdocs\" -AM_CFLAGS += -DSWITCH_GRAMMAR_DIR=\"$(PREFIX)/grammar\" - - libfreeswitch_la_SOURCES = \ -src/include/switch_am_config.h\ -src/include/switch.h\ -src/include/switch_apr.h\ -src/include/switch_buffer.h\ -src/include/switch_caller.h\ -src/include/switch_channel.h\ -src/include/switch_config.h\ -src/include/switch_console.h\ -src/include/switch_core.h\ -src/include/switch_event.h\ -src/include/switch_frame.h\ -src/include/switch_ivr.h\ -src/include/switch_loadable_module.h\ -src/include/switch_module_interfaces.h\ -src/include/switch_platform.h\ -src/include/switch_resample.h\ -src/include/switch_sqlite.h\ -src/include/switch_types.h\ -src/include/switch_utils.h\ -src/include/switch_version.h\ -src/include/switch_rtp.h\ -src/include/switch_stun.h\ -src/include/switch_log.h\ -src/include/switch_xml.h\ -src/switch_rtp.c\ +src/switch_apr.c \ src/switch_buffer.c \ src/switch_caller.c \ src/switch_channel.c \ src/switch_config.c \ src/switch_console.c \ src/switch_core.c \ +src/switch_core_db.c\ src/switch_loadable_module.c \ src/switch_utils.c \ src/switch_event.c \ src/switch_resample.c \ +src/switch_regex.c\ +src/switch_rtp.c\ src/switch_ivr.c \ src/switch_stun.c\ src/switch_log.c\ src/switch_xml.c - - -#bindir = $(PREFIX)/bin -#libdir = $(PREFIX)/lib library_includedir = $(PREFIX)/include + library_include_HEADERS = \ src/include/switch_am_config.h\ src/include/switch.h\ @@ -90,6 +54,7 @@ src/include/switch_channel.h\ src/include/switch_config.h\ src/include/switch_console.h\ src/include/switch_core.h\ +src/include/switch_core_db.h\ src/include/switch_event.h\ src/include/switch_frame.h\ src/include/switch_ivr.h\ @@ -97,7 +62,7 @@ src/include/switch_loadable_module.h\ src/include/switch_module_interfaces.h\ src/include/switch_platform.h\ src/include/switch_resample.h\ -src/include/switch_sqlite.h\ +src/include/switch_regex.h\ src/include/switch_types.h\ src/include/switch_utils.h\ src/include/switch_rtp.h\ @@ -109,13 +74,40 @@ src/include/switch_xml.h BUILT_SOURCES = version depends CLEANFILES = src/include/switch_version.h scripts/fsxs +APR_CONFIG=$(PWD)/libs/apr/apr-1-config +APU_CONFIG=$(PWD)/libs/apr-util/apu-1-config -lib_LTLIBRARIES = libfreeswitch.la -libfreeswitch_la_CFLAGS = $(AM_CFLAGS) -libfreeswitch_la_LDFLAGS = -version-info 1:0:0 -libfreeswitch_la_LIBADD = -lteletone -lresample -lsrtp -lsqlite3 -lpcre +CORE_INCLUDES = -I$(PWD)/libs/apr/include +CORE_INCLUDES += -I$(PWD)/libs/apr-util/include +CORE_INCLUDES += -I$(PWD)/libs/sqlite +CORE_INCLUDES += -I$(PWD)/libs/pcre +CORE_INCLUDES += -I$(PWD)/libs/srtp/include +CORE_INCLUDES += -I$(PWD)/libs/srtp/crypto/include +CORE_INCLUDES += -I$(PWD)/libs/libresample/include +CORE_INCLUDES += -I$(PWD)/libs/libteletone/src + +CORE_CFLAGS = $(shell $(APR_CONFIG) --cflags --cppflags --includes) +CORE_CFLAGS += $(shell $(APU_CONFIG) --includes) +CORE_CFLAGS += -DSWITCH_MOD_DIR=\"$(PREFIX)/mod\" +CORE_CFLAGS += -DSWITCH_PREFIX_DIR=\"$(PREFIX)\" +CORE_CFLAGS += -DSWITCH_CONF_DIR=\"$(PREFIX)/conf\" +CORE_CFLAGS += -DSWITCH_DB_DIR=\"$(PREFIX)/db\" +CORE_CFLAGS += -DSWITCH_LOG_DIR=\"$(PREFIX)/log\" +CORE_CFLAGS += -DSWITCH_SCRIPT_DIR=\"$(PREFIX)/scripts\" +CORE_CFLAGS += -DSWITCH_HTDOCS_DIR=\"$(PREFIX)/htdocs\" +CORE_CFLAGS += -DSWITCH_GRAMMAR_DIR=\"$(PREFIX)/grammar\" + +CORE_LDFLAGS = $(shell $(APR_CONFIG) --link-ld --libs ) +CORE_LDFLAGS += $(shell $(APU_CONFIG) --link-ld --libs ) + +lib_LTLIBRARIES = libfreeswitch.la +libfreeswitch_la_CFLAGS = $(FIRST_INCLUDES) $(CORE_INCLUDES) $(AM_CFLAGS) $(CORE_CFLAGS) +libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(CORE_LDFLAGS) +libfreeswitch_la_LIBADD = -lteletone -lresample -lsrtp -lsqlite3 -lpcre nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h +$(libfreeswitch_la_SOURCES): depends version + bin_PROGRAMS = freeswitch bin_SCRIPTS = scripts/fsxs freeswitch_SOURCES = src/switch.c\ @@ -123,9 +115,6 @@ freeswitch_SOURCES = src/switch.c\ freeswitch_CFLAGS = $(AM_CFLAGS) freeswitch_LDADD = ${top_builddir}/libfreeswitch.la - - - version: Makefile src/include/switch_version.h MAKE=$(MAKE) ./build/checkversion.sh @@ -153,7 +142,6 @@ depends: ./build/buildlib.sh . install libresample --prefix=$(PREFIX) ./build/buildlib.sh . install libteletone --prefix=$(PREFIX) ./build/buildlib.sh . install srtp --prefix=$(PREFIX) -# ./build/buildlib.sh . install libspeakup --prefix=$(PREFIX) ./build/buildlib.sh . install pcre --prefix=$(PREFIX) rm build/freeswitch.env diff --git a/acsite.m4 b/acsite.m4 index 1976022112..56b41940d6 100644 --- a/acsite.m4 +++ b/acsite.m4 @@ -4,4 +4,4 @@ m4_include([build/config/ax_cc_maxopt.m4]) m4_include([build/config/ax_check_compiler_flags.m4]) m4_include([build/config/ac_gcc_archflag.m4]) m4_include([build/config/ac_gcc_x86_cpuid.m4]) - +m4_include([libs/apr/build/apr_common.m4]) diff --git a/configure.in b/configure.in index a0bf3ee448..a23648e537 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,8 @@ AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) AC_CONFIG_AUX_DIR(build/config) AM_INIT_AUTOMAKE(libfreeswitch,0.1) AC_CONFIG_SRCDIR([src/switch.c]) -AC_CONFIG_HEADER([src/include/switch_am_config.h]) +AC_CONFIG_HEADER([src/include/switch_private.h]) + AC_PREFIX_DEFAULT(/usr/local/freeswitch) @@ -134,12 +135,145 @@ AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep]) AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) +# Checks for integer size +AC_CHECK_SIZEOF(char, 1) +AC_CHECK_SIZEOF(int, 4) +AC_CHECK_SIZEOF(long, 4) +AC_CHECK_SIZEOF(short, 2) +AC_CHECK_SIZEOF(long long, 8) +AC_TYPE_SIZE_T +AC_CHECK_TYPE(ssize_t, int) + +# Checks for pointer size +AC_CHECK_SIZEOF(void*, 4) + +if test "x$ac_cv_sizeof_voidp" != "x"; then + voidp_size=$ac_cv_sizeof_voidp +else + AC_ERROR([Cannot determine size of void*]) +fi + +if test "$ac_cv_sizeof_short" = "2"; then + short_value=short +fi +if test "$ac_cv_sizeof_int" = "4"; then + int_value=int +fi + +if test "$ac_cv_sizeof_int" = "8"; then + int64_t_fmt='#define SWITCH_INT64_T_FMT "d"' + uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"' + int64_value="int" + long_value=int +elif test "$ac_cv_sizeof_long" = "8"; then + int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"' + uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"' + int64_value="long" + long_value=long +elif test "$ac_cv_sizeof_long_long" = "8"; then + int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"' + uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"' + int64_value="long long" + long_value="long long" +elif test "$ac_cv_sizeof_longlong" = "8"; then + int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"' + uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"' + int64_value="__int64" + long_value="__int64" +else + AC_ERROR([could not detect a 64-bit integer type]) +fi + +if test "$ac_cv_type_size_t" = "yes"; then + size_t_value="size_t" +else + size_t_value="switch_int32_t" +fi + +if test "$ac_cv_type_ssize_t" = "yes"; then + ssize_t_value="ssize_t" +else + ssize_t_value="switch_int32_t" +fi + +APR_CHECK_SIZEOF_EXTENDED([#include ], ssize_t, 8) + +if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"' +elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' +else + ssize_t_fmt='#error Can not determine the proper size for ssize_t' +fi + +APR_CHECK_SIZEOF_EXTENDED([#include ], size_t, 8) + +if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then + size_t_fmt='#define SWITCH_SIZE_T_FMT "d"' +elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then + size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' +else + size_t_fmt='#error Can not determine the proper size for size_t' +fi + +# Basically, we have tried to figure out the correct format strings +# for SWITCH types which vary between platforms, but we don't always get +# it right. If you find that we don't get it right for your platform, +# you can override our decision below. +# NOTE: borrowed much of this logic from apr. +case $host in + s390*linux*) + # uniquely, the 31-bit Linux/s390 uses "unsigned long int" + # for size_t rather than "unsigned int": + size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"' + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' + ;; + *-os2*) + size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"' + ;; + *aix4*|*aix5*) + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' + size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' + ;; + *beos*) + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' + size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' + ;; + *apple-darwin*) + osver=`uname -r` + case $osver in + [0-7].*) + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"' + ;; + *) + ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' + ;; + esac + size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"' + ;; +esac + +AC_SUBST(voidp_size) +AC_SUBST(short_value) +AC_SUBST(int_value) +AC_SUBST(long_value) +AC_SUBST(int64_value) +AC_SUBST(size_t_value) +AC_SUBST(ssize_t_value) +AC_SUBST(int64_t_fmt) +AC_SUBST(uint64_t_fmt) +AC_SUBST(ssize_t_fmt) +AC_SUBST(size_t_fmt) + + + AC_ARG_ENABLE(crash-protection, [ --enable-crash-protection Compile with CRASH Protection],,[enable_crash_prot="no"]) AM_CONDITIONAL([CRASHPROT],[test "x$enable_crash_prot" != "xno"]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile + src/include/switch_am_config.h]) AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux]) AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin]) diff --git a/libs/win32/pcre/libpcre.vcproj b/libs/win32/pcre/libpcre.vcproj index f672fb82e4..7662d15ffa 100644 --- a/libs/win32/pcre/libpcre.vcproj +++ b/libs/win32/pcre/libpcre.vcproj @@ -53,7 +53,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="./" - PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;DLL_EXPORT" + PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;PCRE_STATIC" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -97,7 +97,7 @@ /> diff --git a/libs/win32/sofia/libsofia_sip_ua_static.vcproj b/libs/win32/sofia/libsofia_sip_ua_static.vcproj index bd064415a7..5763a54f5b 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.vcproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";." - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -123,7 +123,7 @@ Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";." - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -182,247 +182,742 @@ Name="su" Filter="su*.c" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - + + + + + + - + + - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - - + + + + + + + + - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + - - - - + + + + + + + + - - - + + + + + + - + + - - + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + - - + + + + - - - - - + + + + + + + + + + - - - + + + + + + - - - - - - + + + + + + + + + + + + - - - + + + + + + - - + + + + - - - - - - + + + + + + + + + + + + - - - - + + + + + + + + - - + + + + - - - + + + + + + diff --git a/libs/win32/sqlite/sqlite.vcproj b/libs/win32/sqlite/sqlite.vcproj index 22492124d8..d0aa5f918e 100644 --- a/libs/win32/sqlite/sqlite.vcproj +++ b/libs/win32/sqlite/sqlite.vcproj @@ -78,7 +78,7 @@ /> diff --git a/src/include/switch.h b/src/include/switch.h index 954ad3bd04..2d8936fdf2 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -51,12 +51,29 @@ #define FREESWITCH_MIB ".1.3.6.1.4.1." FREESWITCH_PEN #define FREESWITCH_ITAD "543" -#include + +#include +#include +#include +#include #include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #include +#include + +#include +#include #include #include #include @@ -74,7 +91,6 @@ #include #include #include -#include /** \mainpage FreeSWITCH diff --git a/src/include/switch_am_config.h.in b/src/include/switch_am_config.h.in index d7a15df2c8..aa2c7ff399 100644 --- a/src/include/switch_am_config.h.in +++ b/src/include/switch_am_config.h.in @@ -1,131 +1,18 @@ -/* src/include/switch_am_config.h.in. Generated from configure.in by autoheader. */ +#ifndef SWITCH_AM_CONFIG_H +#define SWITCH_AM_CONFIG_H -/* Enable extra debugging. */ -#undef DEBUG -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_DIRENT_H +#define SWITCH_INT_16 @short_value@ +#define SWITCH_INT_32 @int_value@ +#define SWITCH_INT_64 @long_value@ +#define SWITCH_SIZE_T @size_t_value@ +#define SWITCH_SSIZE_T @ssize_t_value@ -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H +#define SWITCH_SIZEOF_VOIDP @voidp_size@ -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME +@ssize_t_fmt@ +@size_t_fmt@ +@int64_t_fmt@ +@uint64_t_fmt@ -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mlock' function. */ -#undef HAVE_MLOCK - -/* Define to 1 if you have the `mlockall' function. */ -#undef HAVE_MLOCKALL - -/* Define to 1 if you have the `mmap' function. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `usleep' function. */ -#undef HAVE_USLEEP - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Enable Optimization. */ -#undef OPTIMZER - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Little Endian */ -#undef SWITCH_BYTE_ORDER - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Version number of package */ -#undef VERSION - -/* sunpro is bad at inline */ -#undef __inline__ - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline #endif - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to `unsigned' if does not define. */ -#undef size_t diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 7fc41dd926..767d63741a 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -39,30 +39,6 @@ #ifndef SWITCH_APR_H #define SWITCH_APR_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include -#include - SWITCH_BEGIN_EXTERN_C /* @@ -76,9 +52,553 @@ SWITCH_BEGIN_EXTERN_C * @{ */ -#define SWITCH_SIZE_T_FMT APR_SIZE_T_FMT -typedef apr_size_t swtich_size_t; -typedef apr_int16_t switch_int16_t; +/** + * @defgroup switch_memory_pool Memory Pool Functions + * @ingroup switch_apr + * @{ + */ +/** The fundamental pool type */ +typedef struct apr_pool_t switch_memory_pool_t; + + +/** + * Clear all memory in the pool and run all the cleanups. This also destroys all + * subpools. + * @param p The pool to clear + * @remark This does not actually free the memory, it just allows the pool + * to re-use this memory for the next allocation. + * @see apr_pool_destroy() + */ +SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p); + +/** @} */ + +/** + * @defgroup switch_dso Dynamic Object Handling Routines + * @ingroup switch_apr + * @{ + */ +/** + * Structure for referencing dynamic objects + */ +typedef struct apr_dso_handle_t switch_dso_handle_t; + +/** + * Structure for referencing symbols from dynamic objects + */ +typedef void * switch_dso_handle_sym_t; + +/** + * Load a DSO library. + * @param res_handle Location to store new handle for the DSO. + * @param path Path to the DSO library + * @param ctx Pool to use. + * @bug We aught to provide an alternative to RTLD_GLOBAL, which + * is the only supported method of loading DSOs today. + */ +SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, + const char *path, switch_memory_pool_t *ctx); + +/** + * Close a DSO library. + * @param handle handle to close. + */ +SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t *handle); + +/** + * Load a symbol from a DSO handle. + * @param ressym Location to store the loaded symbol + * @param handle handle to load the symbol from. + * @param symname Name of the symbol to load. + */ +SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t *ressym, + switch_dso_handle_t *handle, + const char *symname); + +/** + * Report more information when a DSO function fails. + * @param dso The dso handle that has been opened + * @param buf Location to store the dso error + * @param bufsize The size of the provided buffer + */ +SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *buf, size_t bufsize); + +/** @} */ + +/** + * @defgroup switch_string String Handling funcions + * @ingroup switch_apr + * @{ + */ + +#ifndef snprintf +#define snprintf switch_snprintf +#endif + +SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *format, ...); + +SWITCH_DECLARE(int) switch_vasprintf(char **buf, const char *format, va_list ap); + +SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size); + +/** @} */ + +/** + * @defgroup apr_hash Hash Tables + * @ingroup switch_apr + * @{ + */ + +/** Abstract type for hash tables. */ +typedef struct apr_hash_t switch_hash_t; + +/** Abstract type for scanning hash tables. */ +typedef struct apr_hash_index_t switch_hash_index_t; + +/** + * When passing a key to switch_hashfunc_default, this value can be + * passed to indicate a string-valued key, and have the length compute automatically. + * + */ +#define SWITCH_HASH_KEY_STRING (-1) + +/** + * Start iterating over the entries in a hash table. + * @param p The pool to allocate the switch_hash_index_t iterator. If this + * pool is NULL, then an internal, non-thread-safe iterator is used. + * @param ht The hash table + * @remark There is no restriction on adding or deleting hash entries during + * an iteration (although the results may be unpredictable unless all you do + * is delete the current entry) and multiple iterations can be in + * progress at the same time. + + */ +SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t *ht); + +/** + * Continue iterating over the entries in a hash table. + * @param hi The iteration state + * @return a pointer to the updated iteration state. NULL if there are no more + * entries. + */ +SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *ht); + +/** + * Get the current entry's details from the iteration state. + * @param hi The iteration state + * @param key Return pointer for the pointer to the key. + * @param klen Return pointer for the key length. + * @param val Return pointer for the associated value. + * @remark The return pointers should point to a variable that will be set to the + * corresponding data, or they may be NULL if the data isn't interesting. + */ +SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val); + +/** + * The default hash function. + * @param key pointer to the key. + * @param klen the key length. + * + */ +SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen); + +SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht); + +/** @} */ + /** + * @defgroup switch_time Time Routines + * @ingroup switch_apr + * @{ + */ + + /** number of microseconds since 00:00:00 january 1, 1970 UTC */ +typedef int64_t switch_time_t; + + /** number of microseconds in the interval */ +typedef int64_t switch_interval_time_t; + +/** + * a structure similar to ANSI struct tm with the following differences: + * - tm_usec isn't an ANSI field + * - tm_gmtoff isn't an ANSI field (it's a bsdism) + */ +typedef struct switch_time_exp_t { + /** microseconds past tm_sec */ + int32_t tm_usec; + /** (0-61) seconds past tm_min */ + int32_t tm_sec; + /** (0-59) minutes past tm_hour */ + int32_t tm_min; + /** (0-23) hours past midnight */ + int32_t tm_hour; + /** (1-31) day of the month */ + int32_t tm_mday; + /** (0-11) month of the year */ + int32_t tm_mon; + /** year since 1900 */ + int32_t tm_year; + /** (0-6) days since sunday */ + int32_t tm_wday; + /** (0-365) days since jan 1 */ + int32_t tm_yday; + /** daylight saving time */ + int32_t tm_isdst; + /** seconds east of UTC */ + int32_t tm_gmtoff; +} switch_time_exp_t; + +SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec); + +/** + * @return the current time + */ +SWITCH_DECLARE(switch_time_t) switch_time_now(void); + +/** + * Convert time value from human readable format to a numeric apr_time_t that + * always represents GMT + * @param result the resulting imploded time + * @param input the input exploded time + */ +SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input); + +/** + * formats the exploded time according to the format specified + * @param s string to write to + * @param retsize The length of the returned string + * @param max The maximum length of the string + * @param format The format for the time string + * @param tm The time to convert + */ +SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, + switch_size_t *retsize, + switch_size_t max, + const char *format, + switch_time_exp_t *tm); + +/** + * switch_rfc822_date formats dates in the RFC822 + * format in an efficient manner. It is a fixed length + * format which requires the indicated amount of storage, + * including the trailing NUL terminator. + * @param date_str String to write to. + * @param t the time to convert + */ +SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t); + +/** + * convert a time to its human readable components in GMT timezone + * @param result the exploded time + * @param input the time to explode + */ +SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input); + +/** + * Convert time value from human readable format to a numeric apr_time_t + * e.g. elapsed usec since epoch + * @param result the resulting imploded time + * @param input the input exploded time + */ +SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input); + +/** + * convert a time to its human readable components in local timezone + * @param result the exploded time + * @param input the time to explode + */ +SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input); + +/** + * Sleep for the specified number of micro-seconds. + * @param t desired amount of time to sleep. + * @warning May sleep for longer than the specified time. + */ +SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t); + +/** @} */ + +/** + * @defgroup switch_thread_mutex Thread Mutex Routines + * @ingroup switch_apr + * @{ + */ + +/** Opaque thread-local mutex structure */ +typedef struct apr_thread_mutex_t switch_mutex_t; + +/** Lock Flags */ +#define SWITCH_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */ +#define SWITCH_MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */ +#define SWITCH_MUTEX_UNNESTED 0x2 /**< disable nested locks */ + +/** + * Create and initialize a mutex that can be used to synchronize threads. + * @param lock the memory address where the newly created mutex will be + * stored. + * @param flags Or'ed value of: + *
+ *           SWITCH_THREAD_MUTEX_DEFAULT   platform-optimal lock behavior.
+ *           SWITCH_THREAD_MUTEX_NESTED    enable nested (recursive) locks.
+ *           SWITCH_THREAD_MUTEX_UNNESTED  disable nested locks (non-recursive).
+ * 
+ * @param pool the pool from which to allocate the mutex. + * @warning Be cautious in using SWITCH_THREAD_MUTEX_DEFAULT. While this is the + * most optimial mutex based on a given platform's performance charateristics, + * it will behave as either a nested or an unnested lock. + * +*/ +SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, + unsigned int flags, + switch_memory_pool_t *pool); + + +/** + * Destroy the mutex and free the memory associated with the lock. + * @param lock the mutex to destroy. + */ +SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock); + +/** + * Acquire the lock for the given mutex. If the mutex is already locked, + * the current thread will be put to sleep until the lock becomes available. + * @param lock the mutex on which to acquire the lock. + */ +SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock); + +/** + * Release the lock for the given mutex. + * @param lock the mutex from which to release the lock. + */ +SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock); + +/** + * Attempt to acquire the lock for the given mutex. If the mutex has already + * been acquired, the call returns immediately with APR_EBUSY. Note: it + * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine + * if the return value was APR_EBUSY, for portability reasons. + * @param lock the mutex on which to attempt the lock acquiring. + */ +SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock); + +/** @} */ + +/** + * @defgroup switch_thread_rwlock Thread Read/Write lock Routines + * @ingroup switch_apr + * @{ + */ + +/** Opaque structure used for the rwlock */ +typedef struct apr_thread_rwlock_t switch_thread_rwlock_t; + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, + switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock); +SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock); +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock); +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock); +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock); +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock); +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock); + +/** @} */ + +/** + * @defgroup switch_thread_cond Condition Variable Routines + * @ingroup switch_apr + * @{ + */ + +/** + * Note: destroying a condition variable (or likewise, destroying or + * clearing the pool from which a condition variable was allocated) if + * any threads are blocked waiting on it gives undefined results. + */ + +/** Opaque structure for thread condition variables */ +typedef struct apr_thread_cond_t switch_thread_cond_t; + +/** + * Create and initialize a condition variable that can be used to signal + * and schedule threads in a single process. + * @param cond the memory address where the newly created condition variable + * will be stored. + * @param pool the pool from which to allocate the mutex. + */ +SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool); + +/** + * Put the active calling thread to sleep until signaled to wake up. Each + * condition variable must be associated with a mutex, and that mutex must + * be locked before calling this function, or the behavior will be + * undefined. As the calling thread is put to sleep, the given mutex + * will be simultaneously released; and as this thread wakes up the lock + * is again simultaneously acquired. + * @param cond the condition variable on which to block. + * @param mutex the mutex that must be locked upon entering this function, + * is released while the thread is asleep, and is again acquired before + * returning from this function. + */ +SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex); + +/** + * Put the active calling thread to sleep until signaled to wake up or + * the timeout is reached. Each condition variable must be associated + * with a mutex, and that mutex must be locked before calling this + * function, or the behavior will be undefined. As the calling thread + * is put to sleep, the given mutex will be simultaneously released; + * and as this thread wakes up the lock is again simultaneously acquired. + * @param cond the condition variable on which to block. + * @param mutex the mutex that must be locked upon entering this function, + * is released while the thread is asleep, and is again acquired before + * returning from this function. + * @param timeout The amount of time in microseconds to wait. This is + * a maximum, not a minimum. If the condition is signaled, we + * will wake up before this time, otherwise the error APR_TIMEUP + * is returned. + */ +SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout); + +/** + * Signals a single thread, if one exists, that is blocking on the given + * condition variable. That thread is then scheduled to wake up and acquire + * the associated mutex. Although it is not required, if predictable scheduling + * is desired, that mutex must be locked while calling this function. + * @param cond the condition variable on which to produce the signal. + */ +SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond); + +/** + * Signals all threads blocking on the given condition variable. + * Each thread that was signaled is then scheduled to wake up and acquire + * the associated mutex. This will happen in a serialized manner. + * @param cond the condition variable on which to produce the broadcast. + */ +SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond); + +/** + * Destroy the condition variable and free the associated memory. + * @param cond the condition variable to destroy. + */ +SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond); + +/** @} */ + +/** + * @defgroup switch_UUID UUID Handling + * @ingroup switch_apr + * @{ + */ + +/** we represent a UUID as a block of 16 bytes. */ + +typedef struct { + unsigned char data[16]; /**< the actual UUID */ +} switch_uuid_t; + +/** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */ +#define SWITCH_UUID_FORMATTED_LENGTH 36 + +/** + * Format a UUID into a string, following the standard format + * @param buffer The buffer to place the formatted UUID string into. It must + * be at least APR_UUID_FORMATTED_LENGTH + 1 bytes long to hold + * the formatted UUID and a null terminator + * @param uuid The UUID to format + */ +SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid); + +/** + * Generate and return a (new) UUID + * @param uuid The resulting UUID + */ +SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid); + +/** + * Parse a standard-format string into a UUID + * @param uuid The resulting UUID + * @param uuid_str The formatted UUID + */ +SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str); + +/** @} */ + +/** + * @defgroup switch_FIFO Thread Safe FIFO bounded queue + * @ingroup switch_apr + * @{ + */ + +/** Opaque structure used for queue API */ +typedef struct apr_queue_t switch_queue_t; + +/** + * create a FIFO queue + * @param queue The new queue + * @param queue_capacity maximum size of the queue + * @param a pool to allocate queue from + */ +SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, + unsigned int queue_capacity, + switch_memory_pool_t *pool); + +/** + * pop/get an object from the queue, blocking if the queue is already empty + * + * @param queue the queue + * @param data the data + * @returns APR_EINTR the blocking was interrupted (try again) + * @returns APR_EOF if the queue has been terminated + * @returns APR_SUCCESS on a successfull pop + */ +SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data); + +/** + * push/add a object to the queue, blocking if the queue is already full + * + * @param queue the queue + * @param data the data + * @returns APR_EINTR the blocking was interrupted (try again) + * @returns APR_EOF the queue has been terminated + * @returns APR_SUCCESS on a successfull push + */ +SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data); + +/** + * returns the size of the queue. + * + * @warning this is not threadsafe, and is intended for reporting/monitoring + * of the queue. + * @param queue the queue + * @returns the size of the queue + */ +SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue); + +/** + * pop/get an object to the queue, returning immediatly if the queue is empty + * + * @param queue the queue + * @param data the data + * @returns APR_EINTR the blocking operation was interrupted (try again) + * @returns APR_EAGAIN the queue is empty + * @returns APR_EOF the queue has been terminated + * @returns APR_SUCCESS on a successfull push + */ +SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data); + +/** + * push/add a object to the queue, returning immediatly if the queue is full + * + * @param queue the queue + * @param data the data + * @returns APR_EINTR the blocking operation was interrupted (try again) + * @returns APR_EAGAIN the queue is full + * @returns APR_EOF the queue has been terminated + * @returns APR_SUCCESS on a successfull push + */ +SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data); + +/** @} */ /** * @defgroup switch_file_io File I/O Handling Functions @@ -86,19 +606,11 @@ typedef apr_int16_t switch_int16_t; * @{ */ -typedef apr_size_t switch_size_t; - /** Structure for referencing files. */ -typedef apr_file_t switch_file_t; +typedef struct apr_file_t switch_file_t; -#define SWITCH_SO_LINGER APR_SO_LINGER -#define SWITCH_SO_KEEPALIVE APR_SO_KEEPALIVE -#define SWITCH_SO_DEBUG APR_SO_DEBUG -#define SWITCH_SO_NONBLOCK APR_SO_NONBLOCK -#define SWITCH_SO_REUSEADDR APR_SO_REUSEADDR -#define SWITCH_SO_SNDBUF APR_SO_SNDBUF -#define SWITCH_SO_RCVBUF APR_SO_RCVBUF -#define SWITCH_SO_DISCONNECTED APR_SO_DISCONNECTED +typedef int32_t switch_fileperms_t; +typedef int switch_seek_where_t; /** * @defgroup switch_file_permissions File Permissions flags @@ -106,25 +618,25 @@ typedef apr_file_t switch_file_t; * @{ */ -#define SWITCH_FPROT_USETID APR_FPROT_USETID /**< Set user id */ -#define SWITCH_FPROT_UREAD APR_FPROT_UREAD /**< Read by user */ -#define SWITCH_FPROT_UWRITE APR_FPROT_UWRITE /**< Write by user */ -#define SWITCH_FPROT_UEXECUTE APR_FPROT_UEXECUTE /**< Execute by user */ +#define SWITCH_FPROT_USETID 0x8000 /**< Set user id */ +#define SWITCH_FPROT_UREAD 0x0400 /**< Read by user */ +#define SWITCH_FPROT_UWRITE 0x0200 /**< Write by user */ +#define SWITCH_FPROT_UEXECUTE 0x0100 /**< Execute by user */ -#define SWITCH_FPROT_GSETID APR_FPROT_GSETID /**< Set group id */ -#define SWITCH_FPROT_GREAD APR_FPROT_GREAD /**< Read by group */ -#define SWITCH_FPROT_GWRITE APR_FPROT_GWRITE /**< Write by group */ -#define SWITCH_FPROT_GEXECUTE APR_FPROT_GEXECUTE /**< Execute by group */ +#define SWITCH_FPROT_GSETID 0x4000 /**< Set group id */ +#define SWITCH_FPROT_GREAD 0x0040 /**< Read by group */ +#define SWITCH_FPROT_GWRITE 0x0020 /**< Write by group */ +#define SWITCH_FPROT_GEXECUTE 0x0010 /**< Execute by group */ -#define SWITCH_FPROT_WSETID APR_FPROT_U WSETID -#define SWITCH_FPROT_WREAD APR_FPROT_WREAD /**< Read by others */ -#define SWITCH_FPROT_WWRITE APR_FPROT_WWRITE /**< Write by others */ -#define SWITCH_FPROT_WEXECUTE APR_FPROT_WEXECUTE /**< Execute by others */ +#define SWITCH_FPROT_WSTICKY 0x2000 +#define SWITCH_FPROT_WREAD 0x0004 /**< Read by others */ +#define SWITCH_FPROT_WWRITE 0x0002 /**< Write by others */ +#define SWITCH_FPROT_WEXECUTE 0x0001 /**< Execute by others */ -#define SWITCH_FPROT_OS_DEFAULT APR_FPROT_OS_DEFAULT /**< use OS's default permissions */ +#define SWITCH_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */ /* additional permission flags for apr_file_copy and apr_file_append */ -#define SWITCH_FPROT_FILE_SOURCE_PERMS APR_FPROT_FILE_SOURCE_PERMS /**< Copy source file's permissions */ +#define SWITCH_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */ /** @} */ /** @@ -132,20 +644,20 @@ typedef apr_file_t switch_file_t; * @ingroup switch_file_io * @{ */ -#define SWITCH_FOPEN_READ APR_FOPEN_READ /**< Open the file for reading */ -#define SWITCH_FOPEN_WRITE APR_FOPEN_WRITE /**< Open the file for writing */ -#define SWITCH_FOPEN_CREATE APR_FOPEN_CREATE /**< Create the file if not there */ -#define SWITCH_FOPEN_APPEND APR_FOPEN_APPEND /**< Append to the end of the file */ -#define SWITCH_FOPEN_TRUNCATE APR_FOPEN_TRUNCATE /**< Open the file and truncate to 0 length */ -#define SWITCH_FOPEN_BINARY APR_FOPEN_BINARY /**< Open the file in binary mode */ -#define SWITCH_FOPEN_EXCL APR_FOPEN_EXCL /**< Open should fail if APR_CREATE and file exists. */ -#define SWITCH_FOPEN_BUFFERED APR_FOPEN_BUFFERED /**< Open the file for buffered I/O */ -#define SWITCH_FOPEN_DELONCLOSE APR_FOPEN_DELONCLOSE /**< Delete the file after close */ -#define SWITCH_FOPEN_XTHREAD APR_FOPEN_XTHREAD /**< Platform dependent tag to open the file for use across multiple threads */ -#define SWITCH_FOPEN_SHARELOCK APR_FOPEN_SHARELOCK /**< Platform dependent support for higher level locked read/write access to support writes across process/machines */ -#define SWITCH_FOPEN_NOCLEANUP APR_FOPEN_NOCLEANUP /**< Do not register a cleanup when the file is opened */ -#define SWITCH_FOPEN_SENDFILE_ENABLED APR_FOPEN_SENDFILE_ENABLED /**< Advisory flag that this file should support apr_socket_sendfile operation */ -#define SWITCH_FOPEN_LARGEFILE APR_FOPEN_LAREFILE /**< Platform dependent flag to enable large file support */ +#define SWITCH_FOPEN_READ 0x00001 /**< Open the file for reading */ +#define SWITCH_FOPEN_WRITE 0x00002 /**< Open the file for writing */ +#define SWITCH_FOPEN_CREATE 0x00004 /**< Create the file if not there */ +#define SWITCH_FOPEN_APPEND 0x00008 /**< Append to the end of the file */ +#define SWITCH_FOPEN_TRUNCATE 0x00010 /**< Open the file and truncate to 0 length */ +#define SWITCH_FOPEN_BINARY 0x00020 /**< Open the file in binary mode */ +#define SWITCH_FOPEN_EXCL 0x00040 /**< Open should fail if APR_CREATE and file exists. */ +#define SWITCH_FOPEN_BUFFERED 0x00080 /**< Open the file for buffered I/O */ +#define SWITCH_FOPEN_DELONCLOSE 0x00100 /**< Delete the file after close */ +#define SWITCH_FOPEN_XTHREAD 0x00200 /**< Platform dependent tag to open the file for use across multiple threads */ +#define SWITCH_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for higher level locked read/write access to support writes across process/machines */ +#define SWITCH_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup when the file is opened */ +#define SWITCH_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support apr_socket_sendfile operation */ +#define SWITCH_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable large file support */ /** @} */ /** @@ -182,35 +694,16 @@ typedef apr_file_t switch_file_t; * @remark If perm is SWITCH_FPROT_OS_DEFAULT and the file is being created, * appropriate default permissions will be used. */ -DoxyDefine(apr_status_t switch_file_open(switch_file_t **newf, const char *fname, apr_int32_t flag, switch_fileperms_t perm, switch_pool_t *pool);) -#define switch_file_open apr_file_open -#define switch_file_seek apr_file_seek +SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm, switch_memory_pool_t *pool); + + +SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset); /** * Close the specified file. * @param file The file descriptor to close. */ -DoxyDefine(apr_status_t switch_file_close(switch_file_t *file);) -#define switch_file_close apr_file_close - -/** - * Establish a lock on the specified, open file. The lock may be advisory - * or mandatory, at the discretion of the platform. The lock applies to - * the file as a whole, rather than a specific range. Locks are established - * on a per-thread/process basis; a second lock by the same thread will not - * block. - * @param thefile The file to lock. - * @param type The type of lock to establish on the file. - */ -DoxyDefine(apr_status_t apr_file_lock(switch_file_t *thefile, int type);) -#define switch_file_lock apr_file_lock - -/** - * Remove any outstanding locks on the file. - * @param thefile The file to unlock. - */ -DoxyDefine(apr_status_t apr_file_unlock(switch_file_t *thefile);) -#define switch_file_unlock apr_file_unlock +SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile); /** * Delete the specified file. @@ -219,8 +712,7 @@ DoxyDefine(apr_status_t apr_file_unlock(switch_file_t *thefile);) * @remark If the file is open, it won't be removed until all * instances are closed. */ -DoxyDefine(apr_status_t apr_file_remove(const char *path, apr_pool_t *pool);) -#define switch_file_remove apr_file_remove +SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool); /** * Read data from the specified file. @@ -239,8 +731,7 @@ DoxyDefine(apr_status_t apr_file_remove(const char *path, apr_pool_t *pool);) * @remark It is not possible for both bytes to be read and an APR_EOF * or other error to be returned. APR_EINTR is never returned. */ -DoxyDefine(apr_status_t switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes);) -#define switch_file_read apr_file_read +SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes); /** * Write data to the specified file. @@ -257,104 +748,9 @@ DoxyDefine(apr_status_t switch_file_read(switch_file_t *thefile, void *buf, swit * @remark It is possible for both bytes to be written and an error to * be returned. APR_EINTR is never returned. */ -DoxyDefine(apr_status_t switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes);) -#define switch_file_write apr_file_write +SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes); -/** @} */ - -/** - * @defgroup switch_thread_cond Condition Variable Routines - * @ingroup switch_apr - * @{ - */ - -/** - * Note: destroying a condition variable (or likewise, destroying or - * clearing the pool from which a condition variable was allocated) if - * any threads are blocked waiting on it gives undefined results. - */ - -/** Opaque structure for thread condition variables */ -typedef apr_thread_cond_t switch_thread_cond_t; - -/** - * Create and initialize a condition variable that can be used to signal - * and schedule threads in a single process. - * @param cond the memory address where the newly created condition variable - * will be stored. - * @param pool the pool from which to allocate the mutex. - */ -DoxyDefine(apr_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_pool_t *pool);) -#define switch_thread_cond_create apr_thread_cond_create - -typedef apr_os_thread_t switch_thread_id_t; - -#define switch_thread_data_set apr_thread_data_set -#define switch_thread_data_get apr_thread_data_get -#define switch_thread_self apr_os_thread_current -#define switch_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \ - + (apr_time_t)(usec)) - - -/** - * Put the active calling thread to sleep until signaled to wake up. Each - * condition variable must be associated with a mutex, and that mutex must - * be locked before calling this function, or the behavior will be - * undefined. As the calling thread is put to sleep, the given mutex - * will be simultaneously released; and as this thread wakes up the lock - * is again simultaneously acquired. - * @param cond the condition variable on which to block. - * @param mutex the mutex that must be locked upon entering this function, - * is released while the thread is asleep, and is again acquired before - * returning from this function. - */ -DoxyDefine(apr_status_t switch_thread_cond_wait(switch_thread_cond_t *cond, switch_thread_mutex_t *mutex);) -#define switch_thread_cond_wait apr_thread_cond_wait - -/** - * Put the active calling thread to sleep until signaled to wake up or - * the timeout is reached. Each condition variable must be associated - * with a mutex, and that mutex must be locked before calling this - * function, or the behavior will be undefined. As the calling thread - * is put to sleep, the given mutex will be simultaneously released; - * and as this thread wakes up the lock is again simultaneously acquired. - * @param cond the condition variable on which to block. - * @param mutex the mutex that must be locked upon entering this function, - * is released while the thread is asleep, and is again acquired before - * returning from this function. - * @param timeout The amount of time in microseconds to wait. This is - * a maximum, not a minimum. If the condition is signaled, we - * will wake up before this time, otherwise the error APR_TIMEUP - * is returned. - */ -DoxyDefine(apr_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_thread_mutex_t *mutex, switch_interval_time_t timeout);) -#define switch_thread_cond_timedwait apr_thread_cond_timedwait - -/** - * Signals a single thread, if one exists, that is blocking on the given - * condition variable. That thread is then scheduled to wake up and acquire - * the associated mutex. Although it is not required, if predictable scheduling - * is desired, that mutex must be locked while calling this function. - * @param cond the condition variable on which to produce the signal. - */ -DoxyDefine(apr_status_t switch_thread_cond_signal(switch_thread_cond_t *cond);) -#define switch_thread_cond_signal apr_thread_cond_signal - -/** - * Signals all threads blocking on the given condition variable. - * Each thread that was signaled is then scheduled to wake up and acquire - * the associated mutex. This will happen in a serialized manner. - * @param cond the condition variable on which to produce the broadcast. - */ -DoxyDefine(apr_status_t switch_thread_cond_broadcast(switch_thread_cond_t *cond);) -#define switch_thread_cond_broadcast apr_thread_cond_broadcast - -/** - * Destroy the condition variable and free the associated memory. - * @param cond the condition variable to destroy. - */ -DoxyDefine(apr_status_t switch_thread_cond_destroy(switch_thread_cond_t *cond);) -#define switch_thread_cond_destroy apr_thread_cond_destroy +SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename); /** @} */ @@ -365,35 +761,33 @@ DoxyDefine(apr_status_t switch_thread_cond_destroy(switch_thread_cond_t *cond);) */ /** Opaque Thread structure. */ -typedef apr_thread_t switch_thread_t; +typedef struct apr_thread_t switch_thread_t; /** Opaque Thread attributes structure. */ -typedef apr_threadattr_t switch_threadattr_t; +typedef struct apr_threadattr_t switch_threadattr_t; /** * The prototype for any APR thread worker functions. * typedef void *(SWITCH_THREAD_FUNC *switch_thread_start_t)(switch_thread_t*, void*); */ -#define SWITCH_THREAD_FUNC APR_THREAD_FUNC -typedef apr_thread_start_t switch_thread_start_t; +typedef void *(SWITCH_THREAD_FUNC *switch_thread_start_t)(switch_thread_t*, void*); -#define switch_threadattr_stacksize_set apr_threadattr_stacksize_set +//APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, switch_size_t stacksize) +SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize); /** * Create and initialize a new threadattr variable * @param new_attr The newly created threadattr. * @param cont The pool to use */ -DoxyDefine(apr_status_t switch_threadattr_create(switch_threadattr_t **new_attr, switch_pool_t *cont);) -#define switch_threadattr_create apr_threadattr_create +SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool); /** * Set if newly created threads should be created in detached state. * @param attr The threadattr to affect * @param on Non-zero if detached threads should be created. */ -DoxyDefine(apr_status_t switch_threadattr_detach_set(switch_threadattr_t *attr, switch_int32_t on);) -#define switch_threadattr_detach_set apr_threadattr_detach_set +SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on); /** * Create a new thread of execution @@ -403,8 +797,7 @@ DoxyDefine(apr_status_t switch_threadattr_detach_set(switch_threadattr_t *attr, * @param data Any data to be passed to the starting function * @param cont The pool to use */ -DoxyDefine(apr_status_t switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_pool_t *cont);) -#define switch_thread_create apr_thread_create +SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont); /** @} */ @@ -414,56 +807,84 @@ DoxyDefine(apr_status_t switch_thread_create(switch_thread_t **new_thread, switc * @{ */ -/** descriptor refers to a socket */ -#define SWITCH_POLL_SOCKET APR_POLL_SOCKET +#define SWITCH_SO_LINGER 1 +#define SWITCH_SO_KEEPALIVE 2 +#define SWITCH_SO_DEBUG 4 +#define SWITCH_SO_NONBLOCK 8 +#define SWITCH_SO_REUSEADDR 16 +#define SWITCH_SO_SNDBUF 64 +#define SWITCH_SO_RCVBUF 128 +#define SWITCH_SO_DISCONNECTED 256 + + /** + * @def SWITCH_INET + * Not all platforms have these defined, so we'll define them here + * The default values come from FreeBSD 4.1.1 + */ +#define SWITCH_INET AF_INET /** @def SWITCH_UNSPEC * Let the system decide which address family to use */ -#define SWITCH_UNSPEC APR_UNSPEC +#ifdef AF_UNSPEC +#define SWITCH_UNSPEC AF_UNSPEC +#else +#define SWITCH_UNSPEC 0 +#endif /** A structure to represent sockets */ -typedef apr_socket_t switch_socket_t; +typedef struct apr_socket_t switch_socket_t; /** Freeswitch's socket address type, used to ensure protocol independence */ -typedef apr_sockaddr_t switch_sockaddr_t; +typedef struct apr_sockaddr_t switch_sockaddr_t; + +typedef enum { + SWITCH_SHUTDOWN_READ, /**< no longer allow read request */ + SWITCH_SHUTDOWN_WRITE, /**< no longer allow write requests */ + SWITCH_SHUTDOWN_READWRITE /**< no longer allow read or write requests */ +} switch_shutdown_how_e; + +/** + * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets + * @{ + */ +#define SWITCH_PROTO_TCP 6 /**< TCP */ +#define SWITCH_PROTO_UDP 17 /**< UDP */ +#define SWITCH_PROTO_SCTP 132 /**< SCTP */ +/** @} */ -typedef apr_port_t switch_port_t; /* function definitions */ /** * Create a socket. * @param new_sock The new socket that has been set up. - * @param family The address family of the socket (e.g., APR_INET). + * @param family The address family of the socket (e.g., SWITCH_INET). * @param type The type of the socket (e.g., SOCK_STREAM). - * @param protocol The protocol of the socket (e.g., APR_PROTO_TCP). - * @param cont The pool to use + * @param protocol The protocol of the socket (e.g., SWITCH_PROTO_TCP). + * @param pool The pool to use */ -DoxyDefine(apr_status_t switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_pool_t *cont);) -#define switch_socket_create apr_socket_create +SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool); /** * Shutdown either reading, writing, or both sides of a socket. - * @param thesocket The socket to close + * @param sock The socket to close * @param how How to shutdown the socket. One of: *
- *            APR_SHUTDOWN_READ         no longer allow read requests
- *            APR_SHUTDOWN_WRITE        no longer allow write requests
- *            APR_SHUTDOWN_READWRITE    no longer allow read or write requests 
+ *            SWITCH_SHUTDOWN_READ         no longer allow read requests
+ *            SWITCH_SHUTDOWN_WRITE        no longer allow write requests
+ *            SWITCH_SHUTDOWN_READWRITE    no longer allow read or write requests 
  * 
- * @see apr_shutdown_how_e + * @see switch_shutdown_how_e * @remark This does not actually close the socket descriptor, it just * controls which calls are still valid on the socket. */ -DoxyDefine(apr_status_t switch_socket_shutdown(switch_socket_t *thesocket, switch_shutdown_how_e how);) -#define switch_socket_shutdown apr_socket_shutdown +SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how); /** * Close a socket. - * @param thesocket The socket to close + * @param sock The socket to close */ -DoxyDefine(apr_status_t switch_socket_close(switch_socket_t *thesocket);) -#define switch_socket_close apr_socket_close +SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock); /** * Bind the socket to its associated port @@ -472,8 +893,7 @@ DoxyDefine(apr_status_t switch_socket_close(switch_socket_t *thesocket);) * @remark This may be where we will find out if there is any other process * using the selected port. */ -DoxyDefine(apr_status_t switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa);) -#define switch_socket_bind apr_socket_bind +SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa); /** * Listen to a bound socket for connections. @@ -482,8 +902,7 @@ DoxyDefine(apr_status_t switch_socket_bind(switch_socket_t *sock, switch_sockadd * listen queue. If this value is less than zero, the listen * queue size is set to zero. */ -DoxyDefine(apr_status_t switch_socket_listen(switch_socket_t *sock, switch_int32_t backlog);) -#define switch_socket_listen apr_socket_listen +SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog); /** * Accept a new connection request @@ -493,8 +912,7 @@ DoxyDefine(apr_status_t switch_socket_listen(switch_socket_t *sock, switch_int32 * @param sock The socket we are listening on. * @param connection_pool The pool for the new socket. */ -DoxyDefine(apr_status_t switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_pool_t *connection_pool);) -#define switch_socket_accept apr_socket_accept +SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool); /** * Issue a connection request to a socket either on the same machine @@ -502,15 +920,20 @@ DoxyDefine(apr_status_t switch_socket_accept(switch_socket_t **new_sock, switch_ * @param sock The socket we wish to use for our side of the connection * @param sa The address of the machine we wish to connect to. */ -DoxyDefine(apr_status_t switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa);) -#define switch_socket_connect apr_socket_connect +SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa); + +SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa); +SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in); +SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa); +SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa); + /** * Create apr_sockaddr_t from hostname, address family, and port. * @param sa The new apr_sockaddr_t. * @param hostname The hostname or numeric address string to resolve/parse, or * NULL to build an address that corresponds to 0.0.0.0 or :: - * @param family The address family to use, or APR_UNSPEC if the system should + * @param family The address family to use, or SWITCH_UNSPEC if the system should * decide. * @param port The port number. * @param flags Special processing flags: @@ -528,95 +951,7 @@ DoxyDefine(apr_status_t switch_socket_connect(switch_socket_t *sock, switch_sock * * @param p The pool for the apr_sockaddr_t and associated storage. */ -DoxyDefine(apr_status_t switch_sockaddr_info_get(switch_sockaddr_t **sa, - const char *hostname, - switch_int32_t family, - switch_port_t port, - switch_int32_t flags, - switch_pool_t *p);) -#define switch_sockaddr_info_get apr_sockaddr_info_get - -/** - * Look up the host name from an apr_sockaddr_t. - * @param hostname The hostname. - * @param sa The apr_sockaddr_t. - * @param flags Special processing flags. - */ -DoxyDefine(apr_status_t switch_getnameinfo(char **hostname, - switch_sockaddr_t *sa, - switch_int32_t flags);) -#define switch_getnameinfo apr_getnameinfo - -/** - * Parse hostname/IP address with scope id and port. - * - * Any of the following strings are accepted: - * 8080 (just the port number) - * www.apache.org (just the hostname) - * www.apache.org:8080 (hostname and port number) - * [fe80::1]:80 (IPv6 numeric address string only) - * [fe80::1%eth0] (IPv6 numeric address string and scope id) - * - * Invalid strings: - * (empty string) - * [abc] (not valid IPv6 numeric address string) - * abc:65536 (invalid port number) - * - * @param addr The new buffer containing just the hostname. On output, *addr - * will be NULL if no hostname/IP address was specfied. - * @param scope_id The new buffer containing just the scope id. On output, - * *scope_id will be NULL if no scope id was specified. - * @param port The port number. On output, *port will be 0 if no port was - * specified. - * ### FIXME: 0 is a legal port (per RFC 1700). this should - * ### return something besides zero if the port is missing. - * @param str The input string to be parsed. - * @param p The pool from which *addr and *scope_id are allocated. - * @remark If scope id shouldn't be allowed, check for scope_id != NULL in - * addition to checking the return code. If addr/hostname should be - * required, check for addr == NULL in addition to checking the - * return code. - */ -DoxyDefine(apr_status_t switch_parse_addr_port(char **addr, - char **scope_id, - switch_port_t *port, - const char *str, - switch_pool_t *p);) -#define switch_parse_addr_port apr_parse_addr_port - -/** - * Get name of the current machine - * @param buf A buffer to store the hostname in. - * @param len The maximum length of the hostname that can be stored in the - * buffer provided. The suggested length is APRMAXHOSTLEN + 1. - * @param cont The pool to use. - * @remark If the buffer was not large enough, an error will be returned. - */ -DoxyDefine(apr_status_t switch_gethostname(char *buf, int len, switch_pool_t *cont);) -#define switch_gethostname apr_gethostname - -/** - * Return the data associated with the current socket - * @param data The user data associated with the socket. - * @param key The key to associate with the user data. - * @param sock The currently open socket. - */ -DoxyDefine(apr_status_t switch_socket_data_get(void **data, const char *key, - switch_socket_t *sock);) -#define switch_socket_data_get apr_socket_data_get - -/** - * Set the data associated with the current socket. - * @param sock The currently open socket. - * @param data The user data to associate with the socket. - * @param key The key to associate with the data. - * @param cleanup The cleanup to call when the socket is destroyed. - */ -DoxyDefine(apr_status_t switch_socket_data_set(switch_socket_t *sock, - void *data, - const char *key, - switch_status_t (*cleanup)(void*));) -#define switch_socket_data_set apr_socket_data_set +SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool); /** * Send data over a network. @@ -635,33 +970,7 @@ DoxyDefine(apr_status_t switch_socket_data_set(switch_socket_t *sock, * APR_EINTR is never returned. * */ -DoxyDefine(apr_status_t switch_socket_send(switch_socket_t *sock, - const char *buf, - apr_size_t *len);) -#define switch_socket_send apr_socket_send - -/** - * Send multiple packets of data over a network. - * @param sock The socket to send the data over. - * @param vec The array of iovec structs containing the data to send - * @param nvec The number of iovec structs in the array - * @param len Receives the number of bytes actually written - * @remark - *
- * This functions acts like a blocking write by default.  To change 
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- * The number of bytes actually sent is stored in argument 3.
- *
- * It is possible for both bytes to be sent and an error to be returned.
- *
- * APR_EINTR is never returned.
- * 
- */ -DoxyDefine(apr_status_t switch_socket_sendv(switch_socket_t *sock, - const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len);) -#define switch_socket_sendv apr_socket_sendv +SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len); /** * @param sock The socket to send from @@ -670,12 +979,7 @@ DoxyDefine(apr_status_t switch_socket_sendv(switch_socket_t *sock, * @param buf The data to send * @param len The length of the data to send */ -DoxyDefine(apr_status_t switch_socket_sendto(switcj_socket_t *sock, - apr_sockaddr_t *where, - apr_int32_t flags, - const char *buf, - apr_size_t *len);) -#define switch_socket_sendto apr_socket_sendto +SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len); /** * @param from The apr_sockaddr_t to fill in the recipient info @@ -684,40 +988,13 @@ DoxyDefine(apr_status_t switch_socket_sendto(switcj_socket_t *sock, * @param buf The buffer to use * @param len The length of the available buffer * - -DoxyDefine(apr_status_t switch_socket_recvfrom(switch_sockaddr_t *from, - switch_socket_t *sock, - apr_int32_t flags, - char *buf, - apr_size_t *len);) -#define switch_socket_recvfrom apr_socket_recvfrom -*/ - -/** - * Send a file from an open file descriptor to a socket, along with - * optional headers and trailers - * @param sock The socket to which we're writing - * @param file The open file from which to read - * @param hdtr A structure containing the headers and trailers to send - * @param offset Offset into the file where we should begin writing - * @param len (input) - Number of bytes to send from the file - * (output) - Number of bytes actually sent, - * including headers, file, and trailers - * @param flags APR flags that are mapped to OS specific flags - * @remark This functions acts like a blocking write by default. To change - * this behavior, use apr_socket_timeout_set() or the - * APR_SO_NONBLOCK socket option. - * The number of bytes actually sent is stored in the len parameter. - * The offset parameter is passed by reference for no reason; its - * value will never be modified by the apr_socket_sendfile() function. */ -DoxyDefine(apr_status_t switch_socket_sendfile(apr_socket_t *sock, - switch_file_t *file, - apr_hdtr_t *hdtr, - apr_off_t *offset, - apr_size_t *len, - apr_int32_t flags);) -#define switch_socket_sendfile apr_socket_sendfile +SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, + switch_socket_t *sock, + int32_t flags, + char *buf, + size_t *len); + /** * Read data from a network. @@ -738,10 +1015,7 @@ DoxyDefine(apr_status_t switch_socket_sendfile(apr_socket_t *sock, * APR_EINTR is never returned. * */ -DoxyDefine(apr_status_t switch_socket_recv(switch_socket_t *sock, - char *buf, - apr_size_t *len);) -#define switch_socket_recv apr_socket_recv +SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len); /** * Setup socket options for the specified socket @@ -765,10 +1039,7 @@ DoxyDefine(apr_status_t switch_socket_recv(switch_socket_t *sock, * * @param on Value for the option. */ -DoxyDefine(apr_status_t switch_socket_opt_set(switch_socket_t *sock, - apr_int32_t opt, - apr_int32_t on);) -#define switch_socket_opt_set apr_socket_opt_set +SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on); /** * Setup socket timeout for the specified socket @@ -781,138 +1052,7 @@ DoxyDefine(apr_status_t switch_socket_opt_set(switch_socket_t *sock, * t < 0 -- read and write calls block * */ -DoxyDefine(apr_status_t switch_socket_timeout_set(switch_socket_t *sock, - apr_interval_time_t t);) -#define switch_socket_timeout_set apr_socket_timeout_set - -/** - * Query socket options for the specified socket - * @param sock The socket to query - * @param opt The option we would like to query. One of: - *
- *            APR_SO_DEBUG      --  turn on debugging information 
- *            APR_SO_KEEPALIVE  --  keep connections active
- *            APR_SO_LINGER     --  lingers on close if data is present
- *            APR_SO_NONBLOCK   --  Turns blocking on/off for socket
- *            APR_SO_REUSEADDR  --  The rules used in validating addresses
- *                                  supplied to bind should allow reuse
- *                                  of local addresses.
- *            APR_SO_SNDBUF     --  Set the SendBufferSize
- *            APR_SO_RCVBUF     --  Set the ReceiveBufferSize
- *            APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
- *                                  (Currently only used on Windows)
- * 
- * @param on Socket option returned on the call. - */ -DoxyDefine(apr_status_t switch_socket_opt_get(switch_socket_t *sock, - apr_int32_t opt, apr_int32_t *on);) -#define switch_socket_opt_get apr_socket_opt_get - -/** - * Query socket timeout for the specified socket - * @param sock The socket to query - * @param t Socket timeout returned from the query. - */ -DoxyDefine(apr_status_t switch_socket_timeout_get(switch_socket_t *sock, - apr_interval_time_t *t);) -#define switch_socket_timeout_get apr_socket_timeout_get - -/** - * Query the specified socket if at the OOB/Urgent data mark - * @param sock The socket to query - * @param atmark Is set to true if socket is at the OOB/urgent mark, - * otherwise is set to false. - */ -DoxyDefine(apr_status_t switch_socket_atmark(switch_socket_t *sock, - int *atmark);) -#define switch_socket_atmark apr_socket_atmark - -/** - * Return an apr_sockaddr_t from an apr_socket_t - * @param sa The returned apr_sockaddr_t. - * @param which Which interface do we want the apr_sockaddr_t for? - * @param sock The socket to use - */ -DoxyDefine(apr_status_t switch_socket_addr_get(switch_sockaddr_t **sa, - apr_interface_e which, - switch_socket_t *sock);) -#define switch_socket_addr_get apr_socket_addr_get - -/** - * Return the IP address (in numeric address string format) in - * an APR socket address. APR will allocate storage for the IP address - * string from the pool of the apr_sockaddr_t. - * @param addr The IP address. - * @param sockaddr The socket address to reference. - */ -DoxyDefine(apr_status_t switch_sockaddr_ip_get(char **addr, - switch_sockaddr_t *sockaddr);) -#define switch_sockaddr_ip_get apr_sockaddr_ip_get - -/** - * See if the IP addresses in two APR socket addresses are - * equivalent. Appropriate logic is present for comparing - * IPv4-mapped IPv6 addresses with IPv4 addresses. - * - * @param addr1 One of the APR socket addresses. - * @param addr2 The other APR socket address. - * @remark The return value will be non-zero if the addresses - * are equivalent. - */ -DoxyDefine(int switch_sockaddr_equal(const switch_sockaddr_t *addr1, - const switch_sockaddr_t *addr2);) -#define switch_sockaddr_equal apr_sockaddr_equal - -/** -* Return the type of the socket. -* @param sock The socket to query. -* @param type The returned type (e.g., SOCK_STREAM). -*/ -DoxyDefine(apr_status_t switch_socket_type_get(switch_socket_t *sock, - int *type);) -#define switch_socket_type_get apr_socket_type_get - -/** - * Given an switch_sockaddr_t and a service name, set the port for the service - * @param sockaddr The switch_sockaddr_t that will have its port set - * @param servname The name of the service you wish to use - */ -DoxyDefine(apr_status_t switch_getservbyname(switch_sockaddr_t *sockaddr, - const char *servname);) -#define switch_getservbyname apr_getservbyname - -/** - * Build an ip-subnet representation from an IP address and optional netmask or - * number-of-bits. - * @param ipsub The new ip-subnet representation - * @param ipstr The input IP address string - * @param mask_or_numbits The input netmask or number-of-bits string, or NULL - * @param p The pool to allocate from - */ -DoxyDefine(apr_status_t switch_ipsubnet_create(apr_ipsubnet_t **ipsub, - const char *ipstr, - const char *mask_or_numbits, - switch_pool_t *p);) -#define switch_ipsubnet_create apr_ipsubnet_create - -/** - * Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet - * representation. - * @param ipsub The ip-subnet representation - * @param sa The socket address to test - * @return non-zero if the socket address is within the subnet, 0 otherwise - */ -DoxyDefine(int switch_ipsubnet_test(apr_ipsubnet_t *ipsub, switch_sockaddr_t *sa);) -#define switch_ipsubnet_test apr_ipsubnet_test - -/** - * Return the protocol of the socket. - * @param sock The socket to query. - * @param protocol The returned protocol (e.g., APR_PROTO_TCP). - */ -DoxyDefine(apr_status_t switch_socket_protocol_get(switch_socket_t *sock, - int *protocol);) -#define switch_socket_protocol_get apr_socket_protocol_get +SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t); /** * Join a Multicast Group @@ -923,78 +1063,10 @@ DoxyDefine(apr_status_t switch_socket_protocol_get(switch_socket_t *sock, * @param source Source Address to accept transmissions from (non-NULL * implies Source-Specific Multicast) */ -DoxyDefine(apr_status_t switch_mcast_join(switch_socket_t *sock, - switch_sockaddr_t *join, - switch_sockaddr_t *iface, - switch_sockaddr_t *source);) -#define switch_mcast_join apr_mcast_join - -/** - * Leave a Multicast Group. All arguments must be the same as - * switch_mcast_join. - * @param sock The socket to leave a multicast group - * @param addr The address of the multicast group to leave - * @param iface Address of the interface to use. If NULL is passed, the - * default multicast interface will be used. (OS Dependent) - * @param source Source Address to accept transmissions from (non-NULL - * implies Source-Specific Multicast) - */ -DoxyDefine(apr_status_t switch_mcast_leave(switch_socket_t *sock, - switch_sockaddr_t *addr, - switch_sockaddr_t *iface, - switch_sockaddr_t *source);) -#define switch_mcast_leave apr_mcast_leave - -/** - * Set the Multicast Time to Live (ttl) for a multicast transmission. - * @param sock The socket to set the multicast ttl - * @param ttl Time to live to Assign. 0-255, default=1 - * @remark If the TTL is 0, packets will only be seen by sockets on - * the local machine, and only when multicast loopback is enabled. - */ -DoxyDefine(apr_status_t switch_mcast_hops(switch_socket_t *sock, - apr_byte_t ttl);) -#define switch_mcast_hops apr_mcast_hops - -/** - * Toggle IP Multicast Loopback - * @param sock The socket to set multicast loopback - * @param opt 0=disable, 1=enable - */ -DoxyDefine(apr_status_t switch_mcast_loopback(switch_socket_t *sock, - apr_byte_t opt);) -#define switch_mcast_loopback apr_mcast_loopback - -/** - * Set the Interface to be used for outgoing Multicast Transmissions. - * @param sock The socket to set the multicast interface on - * @param iface Address of the interface to use for Multicast - */ -DoxyDefine(apr_status_t switch_mcast_interface(switch_socket_t *sock, - switch_sockaddr_t *iface);) -#define switch_mcast_interface apr_mcast_interface - -/** @} */ - -/** - * @defgroup switch_memory_pool Memory Pool Functions - * @ingroup switch_apr - * @{ - */ -/** The fundamental pool type */ -typedef apr_pool_t switch_memory_pool_t; +SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source); + -/** - * Clear all memory in the pool and run all the cleanups. This also destroys all - * subpools. - * @param p The pool to clear - * @remark This does not actually free the memory, it just allows the pool - * to re-use this memory for the next allocation. - * @see apr_pool_destroy() - */ -DoxyDefine(void switch_pool_clear(switch_memory_pool_t *p);) -#define switch_pool_clear apr_pool_clear /** @} */ /** @@ -1003,20 +1075,20 @@ DoxyDefine(void switch_pool_clear(switch_memory_pool_t *p);) * @{ */ /** Poll descriptor set. */ -typedef apr_pollfd_t switch_pollfd_t; +typedef struct apr_pollfd_t switch_pollfd_t; /** Opaque structure used for pollset API */ -typedef apr_pollset_t switch_pollset_t; +typedef struct apr_pollset_t switch_pollset_t; /** * Poll options */ -#define SWITCH_POLLIN APR_POLLIN /**< Can read without blocking */ -#define SWITCH_POLLPRI APR_POLLPRI /**< Priority data available */ -#define SWITCH_POLLOUT APR_POLLOUT /**< Can write without blocking */ -#define SWITCH_POLLERR APR_POLLERR /**< Pending error */ -#define SWITCH_POLLHUP APR_POLLHUP /**< Hangup occurred */ -#define SWITCH_POLLNVAL APR_POLLNVAL /**< Descriptior invalid */ +#define SWITCH_POLLIN 0x001 /**< Can read without blocking */ +#define SWITCH_POLLPRI 0x002 /**< Priority data available */ +#define SWITCH_POLLOUT 0x004 /**< Can write without blocking */ +#define SWITCH_POLLERR 0x010 /**< Pending error */ +#define SWITCH_POLLHUP 0x020 /**< Hangup occurred */ +#define SWITCH_POLLNVAL 0x040 /**< Descriptior invalid */ /** * Setup a pollset object @@ -1032,11 +1104,10 @@ typedef apr_pollset_t switch_pollset_t; * platforms; the apr_pollset_create() call will fail with * APR_ENOTIMPL on platforms where it is not supported. */ -DoxyDefine(apr_status_t switch_pollset_create(switch_pollset_t **pollset, - apr_uint32_t size, - switch_memory_pool_t *p, - apr_uint32_t flags);) -#define switch_pollset_create apr_pollset_create +SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, + uint32_t size, + switch_memory_pool_t *p, + uint32_t flags); /** * Add a socket or file descriptor to a pollset @@ -1055,9 +1126,8 @@ DoxyDefine(apr_status_t switch_pollset_create(switch_pollset_t **pollset, * allowed for implementations where option (1) is impossible * or impractical. */ -DoxyDefine(apr_status_t switch_pollset_add(switch_pollset_t *pollset, - const switch_pollfd_t *descriptor);) -#define switch_pollset_add apr_pollset_add +SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, + const switch_pollfd_t *descriptor); /** * Poll the sockets in the poll structure @@ -1072,411 +1142,27 @@ DoxyDefine(apr_status_t switch_pollset_add(switch_pollset_t *pollset, * This is a blocking call, and it will not return until either a * socket has been signalled, or the timeout has expired. */ -DoxyDefine(apr_status_t switch_poll(switch_pollfd_t *aprset, apr_int32_t numsock, - apr_int32_t *nsds, - apr_interval_time_t timeout);) -#define switch_poll apr_poll +SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, + int32_t numsock, + int32_t *nsds, + switch_interval_time_t timeout); + +/*! + \brief Create a set of file descriptors to poll + \param poll the polfd to create + \param sock the socket to add + \param flags the flags to modify the behaviour + \param pool the memory pool to use + \return SWITCH_STATUS_SUCCESS when successful +*/ +SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool); + /** @} */ - /** - * @defgroup switch_time Time Routines - * @ingroup switch_apr - * @{ - */ - - /** number of microseconds since 00:00:00 january 1, 1970 UTC */ -typedef apr_time_t switch_time_t; - - /** number of microseconds in the interval */ -typedef apr_interval_time_t switch_interval_time_t; - -/** - * a structure similar to ANSI struct tm with the following differences: - * - tm_usec isn't an ANSI field - * - tm_gmtoff isn't an ANSI field (it's a bsdism) - */ -typedef apr_time_exp_t switch_time_exp_t; - -/** - * @return the current time - */ -DoxyDefine(switch_time_t switch_time_now(void);) -#define switch_time_now apr_time_now - -/** - * Convert time value from human readable format to a numeric apr_time_t that - * always represents GMT - * @param result the resulting imploded time - * @param input the input exploded time - */ -DoxyDefine(switch_status_t switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input);) -#define switch_time_exp_gmt_get apr_time_exp_gmt_get - -/** - * formats the exploded time according to the format specified - * @param s string to write to - * @param retsize The length of the returned string - * @param max The maximum length of the string - * @param format The format for the time string - * @param tm The time to convert - */ -DoxyDefine(apr_status_t switch_strftime(char *s, apr_size_t *retsize, - apr_size_t max, const char *format, - switch_time_exp_t *tm);) -#define switch_strftime apr_strftime - -/** - * switch_rfc822_date formats dates in the RFC822 - * format in an efficient manner. It is a fixed length - * format which requires the indicated amount of storage, - * including the trailing NUL terminator. - * @param date_str String to write to. - * @param t the time to convert - */ -DoxyDefine(apr_status_t switch_rfc822_date(char *date_str, switch_time_t t);) -#define switch_rfc822_date apr_rfc822_date - -/** - * convert a time to its human readable components in GMT timezone - * @param result the exploded time - * @param input the time to explode - */ -DoxyDefine(apr_status_t switch_time_exp_gmt(switch_time_exp_t *result, - switch_time_t input);) -#define switch_time_exp_gmt apr_time_exp_gmt - -/** - * Convert time value from human readable format to a numeric apr_time_t - * e.g. elapsed usec since epoch - * @param result the resulting imploded time - * @param input the input exploded time - */ -DoxyDefine(apr_status_t switch_time_exp_get(switch_time_t *result, - switch_time_exp_t *input);) -#define switch_time_exp_get apr_time_exp_get - -/** - * convert a time to its human readable components in local timezone - * @param result the exploded time - * @param input the time to explode - */ -DoxyDefine(apr_status_t switch_time_exp_lt(switch_time_exp_t *result, - switch_time_t input);) -#define switch_time_exp_lt apr_time_exp_lt - -/** - * Sleep for the specified number of micro-seconds. - * @param t desired amount of time to sleep. - * @warning May sleep for longer than the specified time. - */ -DoxyDefine(void switch_sleep(apr_interval_time_t t);) -#define switch_sleep apr_sleep - -/** @} */ - -/** - * @defgroup apr_hash Hash Tables - * @ingroup switch_apr - * @{ - */ - -/** Abstract type for hash tables. */ -typedef apr_hash_t switch_hash_t; - -/** Abstract type for scanning hash tables. */ -typedef apr_hash_index_t switch_hash_index_t; - -/** - * Start iterating over the entries in a hash table. - * @param p The pool to allocate the switch_hash_index_t iterator. If this - * pool is NULL, then an internal, non-thread-safe iterator is used. - * @param ht The hash table - * @remark There is no restriction on adding or deleting hash entries during - * an iteration (although the results may be unpredictable unless all you do - * is delete the current entry) and multiple iterations can be in - * progress at the same time. - - */ -DoxyDefine(switch_hash_index_t * switch_hash_first(switch_memory_pool_t *p, switch_hash_t *ht);) -#define switch_hash_first apr_hash_first - -/** - * Continue iterating over the entries in a hash table. - * @param hi The iteration state - * @return a pointer to the updated iteration state. NULL if there are no more - * entries. - */ -DoxyDefine(switch_hash_index_t * switch_hash_next(switch_hash_index_t *hi);) -#define switch_hash_next apr_hash_next - -/** - * Get the current entry's details from the iteration state. - * @param hi The iteration state - * @param key Return pointer for the pointer to the key. - * @param klen Return pointer for the key length. - * @param val Return pointer for the associated value. - * @remark The return pointers should point to a variable that will be set to the - * corresponding data, or they may be NULL if the data isn't interesting. - */ -DoxyDefine(void switch_hash_this(switch_hash_index_t *hi, const void **key, - apr_ssize_t *klen, void **val);) -#define switch_hash_this apr_hash_this - -/** @} */ - -/** - * @defgroup switch_StrMatch String matching routines - * @ingroup switch_apr - * @{ - */ - -/** Precompiled search pattern */ -typedef apr_strmatch_pattern switch_strmatch_pattern; - -/** - * Precompile a pattern for matching using the Boyer-Moore-Horspool algorithm - * @param p The pool from which to allocate the pattern - * @param s The pattern string - * @param case_sensitive Whether the matching should be case-sensitive - * @return a pointer to the compiled pattern, or NULL if compilation fails - */ -DoxyDefine(const switch_strmatch_pattern * switch_strmatch_precompile(switch_memory_pool_t *p, const char *s, int case_sensitive);) -#define switch_strmatch_precompile apr_strmatch_precompile - -/** - * Search for a precompiled pattern within a string - * @param pattern The pattern - * @param s The string in which to search for the pattern - * @param slen The length of s (excluding null terminator) - * @return A pointer to the first instance of the pattern in s, or - * NULL if not found - */ -DoxyDefine(const char * switch_strmatch(const switch_strmatch_pattern *pattern, - const char *s, apr_size_t slen);) -#define switch_strmatch apr_strmatch -/** @} */ - -/** - * @defgroup switch_UUID UUID Handling - * @ingroup switch_apr - * @{ - */ - -/** we represent a UUID as a block of 16 bytes. */ - -typedef apr_uuid_t switch_uuid_t; - -/** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */ - -/** - * Format a UUID into a string, following the standard format - * @param buffer The buffer to place the formatted UUID string into. It must - * be at least APR_UUID_FORMATTED_LENGTH + 1 bytes long to hold - * the formatted UUID and a null terminator - * @param uuid The UUID to format - */ -DoxyDefine(void switch_uuid_format(char *buffer, const switch_uuid_t *uuid);) -#define switch_uuid_format apr_uuid_format - -/** - * Generate and return a (new) UUID - * @param uuid The resulting UUID - */ -DoxyDefine(void switch_uuid_get(switch_uuid_t *uuid);) -#define switch_uuid_get apr_uuid_get - -/** - * Parse a standard-format string into a UUID - * @param uuid The resulting UUID - * @param uuid_str The formatted UUID - */ -DoxyDefine(apr_status_t switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str);) -#define switch_uuid_parse apr_uuid_parse - -/** @} */ - -/** - * @defgroup switch_FIFO Thread Safe FIFO bounded queue - * @ingroup switch_apr - * @{ - */ - -/** Opaque structure used for queue API */ -typedef apr_queue_t switch_queue_t; - -/** - * create a FIFO queue - * @param queue The new queue - * @param queue_capacity maximum size of the queue - * @param a pool to allocate queue from - */ -DoxyDefine(apr_status_t switch_queue_create(switch_queue_t **queue, - unsigned int queue_capacity, - switch_memory_pool_t *a);) -#define switch_queue_create apr_queue_create - -/** - * interrupt all the threads blocking on this queue. - * - * @param queue the queue - */ -DoxyDefine(apr_status_t switch_queue_interrupt_all(switch_queue_t *queue);) -#define switch_queue_interrupt_all apr_queue_interrupt_all - -/** - * pop/get an object from the queue, blocking if the queue is already empty - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking was interrupted (try again) - * @returns APR_EOF if the queue has been terminated - * @returns APR_SUCCESS on a successfull pop - */ -DoxyDefine(apr_status_t switch_queue_pop(switch_queue_t *queue, void **data);) -#define switch_queue_pop apr_queue_pop - -/** - * push/add a object to the queue, blocking if the queue is already full - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking was interrupted (try again) - * @returns APR_EOF the queue has been terminated - * @returns APR_SUCCESS on a successfull push - */ -DoxyDefine(apr_status_t switch_queue_push(switch_queue_t *queue, void *data);) -#define switch_queue_push apr_queue_push - -/** - * returns the size of the queue. - * - * @warning this is not threadsafe, and is intended for reporting/monitoring - * of the queue. - * @param queue the queue - * @returns the size of the queue - */ -DoxyDefine(unsigned int switch_queue_size(switch_queue_t *queue);) -#define switch_queue_size apr_queue_size - -/** - * terminate all queue, sendinging a interupt to all the - * blocking threads - * - * @param queue the queue - */ -DoxyDefine(apr_status_t switch_queue_term(switch_queue_t *queue);) -#define switch_queue_term apr_queue_term - -/** - * pop/get an object to the queue, returning immediatly if the queue is empty - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking operation was interrupted (try again) - * @returns APR_EAGAIN the queue is empty - * @returns APR_EOF the queue has been terminated - * @returns APR_SUCCESS on a successfull push - */ -DoxyDefine(apr_status_t switch_queue_trypop(switch_queue_t *queue, void **data);) -#define switch_queue_trypop apr_queue_trypop - -/** - * push/add a object to the queue, returning immediatly if the queue is full - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking operation was interrupted (try again) - * @returns APR_EAGAIN the queue is full - * @returns APR_EOF the queue has been terminated - * @returns APR_SUCCESS on a successfull push - */ -DoxyDefine(apr_status_t switch_queue_trypush(switch_queue_t *queue, void *data);) -#define switch_queue_trypush apr_queue_trypush - -/** @} */ -typedef apr_thread_rwlock_t switch_thread_rwlock_t; -#define switch_thread_rwlock_create apr_thread_rwlock_create -#define switch_thread_rwlock_destroy apr_thread_rwlock_destroy -#define switch_thread_rwlock_pool_get apr_thread_rwlock_pool_get -#define switch_thread_rwlock_rdlock apr_thread_rwlock_rdlock -#define switch_thread_rwlock_tryrdlock apr_thread_rwlock_tryrdlock -#define switch_thread_rwlock_trywrlock apr_thread_rwlock_trywrlock -#define switch_thread_rwlock_unlock apr_thread_rwlock_unlock -#define switch_thread_rwlock_wrlock apr_thread_rwlock_wrlock - -/** - * @defgroup switch_thread_mutex Thread Mutex Routines - * @ingroup switch_apr - * @{ - */ - -/** Opaque thread-local mutex structure */ -typedef apr_thread_mutex_t switch_mutex_t; - -/** Lock Flags */ - -#define SWITCH_MUTEX_DEFAULT APR_THREAD_MUTEX_DEFAULT /**< platform-optimal lock behavior */ -#define SWITCH_MUTEX_NESTED APR_THREAD_MUTEX_NESTED /**< enable nested (recursive) locks */ -#define SWITCH_MUTEX_UNNESTED APR_THREAD_MUTEX_UNNESTED /**< disable nested locks */ - - -/** - * Create and initialize a mutex that can be used to synchronize threads. - * @param lock the memory address where the newly created mutex will be - * stored. - * @param flags Or'ed value of: - *
- *           SWITCH_THREAD_MUTEX_DEFAULT   platform-optimal lock behavior.
- *           SWITCH_THREAD_MUTEX_NESTED    enable nested (recursive) locks.
- *           SWITCH_THREAD_MUTEX_UNNESTED  disable nested locks (non-recursive).
- * 
- * @param pool the pool from which to allocate the mutex. - * @warning Be cautious in using SWITCH_THREAD_MUTEX_DEFAULT. While this is the - * most optimial mutex based on a given platform's performance charateristics, - * it will behave as either a nested or an unnested lock. - * -SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, - switch_lock_flag flags, - switch_memory_pool_t *pool); -*/ -#define switch_mutex_init apr_thread_mutex_create -/** - * Destroy the mutex and free the memory associated with the lock. - * @param lock the mutex to destroy. - */ -//SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock); -#define switch_mutex_destroy apr_thread_mutex_destroy - -/** - * Acquire the lock for the given mutex. If the mutex is already locked, - * the current thread will be put to sleep until the lock becomes available. - * @param lock the mutex on which to acquire the lock. - */ -//SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock); -#define switch_mutex_lock apr_thread_mutex_lock - -/** - * Release the lock for the given mutex. - * @param lock the mutex from which to release the lock. - */ -//SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock); -#define switch_mutex_unlock apr_thread_mutex_unlock - -/** - * Attempt to acquire the lock for the given mutex. If the mutex has already - * been acquired, the call returns immediately with APR_EBUSY. Note: it - * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine - * if the return value was APR_EBUSY, for portability reasons. - * @param lock the mutex on which to attempt the lock acquiring. - */ -//SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock); -#define switch_mutex_trylock apr_thread_mutex_trylock - -/** @} */ /** @} */ /** @} */ diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h new file mode 100644 index 0000000000..be700d73c4 --- /dev/null +++ b/src/include/switch_core_db.h @@ -0,0 +1,378 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II + * Michael Jerris + * + * switch_core_db.h -- Sqlite wrapper and extensions Header + * + */ +/*! \file switch_core_db.h + \brief Core DB Header +*/ +#ifndef SWITCH_CORE_DB_H +#define SWITCH_CORE_DB_H + +SWITCH_BEGIN_EXTERN_C + +/** + * @defgroup switch_sqlite_top Brought To You By SQLite + * @ingroup FREESWITCH + * @{ + */ + +/** + * @defgroup switch_core_db Database Routines + * @ingroup switch_sqlite_top + * @{ + */ + +/** + * Each open database is represented by an instance of the + * following opaque structure. +*/ + +typedef struct sqlite3 switch_core_db_t; +typedef struct sqlite3_stmt switch_core_db_stmt_t; + +typedef int (*switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames); + +/** + * A function to close the database. + * + * Call this function with a pointer to a structure that was previously + * returned from switch_core_db_open() and the corresponding database will by closed. + * + * All SQL statements prepared using switch_core_db_prepare() + * must be deallocated using switch_core_db_finalize() before + * this routine is called. Otherwise, SWITCH_CORE_DB_BUSY is returned and the + * database connection remains open. + */ +SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db); + +/** + * Open the database file "filename". The "filename" is UTF-8 + * encoded. A switch_core_db_t* handle is returned in *Db, even + * if an error occurs. If the database is opened (or created) successfully, + * then SWITCH_CORE_DB_OK is returned. Otherwise an error code is returned. The + * switch_core_db_errmsg() routine can be used to obtain + * an English language description of the error. + * + * If the database file does not exist, then a new database is created. + * The encoding for the database is UTF-8. + * + * Whether or not an error occurs when it is opened, resources associated + * with the switch_core_db_t* handle should be released by passing it to + * switch_core_db_close() when it is no longer required. + */ +SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb); + +/** + * The next group of routines returns information about the information + * in a single column of the current result row of a query. In every + * case the first parameter is a pointer to the SQL statement that is being + * executed (the switch_core_db_stmt_t* that was returned from switch_core_db_prepare()) and + * the second argument is the index of the column for which information + * should be returned. iCol is zero-indexed. The left-most column as an + * index of 0. + * + * If the SQL statement is not currently point to a valid row, or if the + * the colulmn index is out of range, the result is undefined. + * + * These routines attempt to convert the value where appropriate. For + * example, if the internal representation is FLOAT and a text result + * is requested, sprintf() is used internally to do the conversion + * automatically. The following table details the conversions that + * are applied: + * + * Internal Type Requested Type Conversion + * ------------- -------------- -------------------------- + * NULL INTEGER Result is 0 + * NULL FLOAT Result is 0.0 + * NULL TEXT Result is an empty string + * NULL BLOB Result is a zero-length BLOB + * INTEGER FLOAT Convert from integer to float + * INTEGER TEXT ASCII rendering of the integer + * INTEGER BLOB Same as for INTEGER->TEXT + * FLOAT INTEGER Convert from float to integer + * FLOAT TEXT ASCII rendering of the float + * FLOAT BLOB Same as FLOAT->TEXT + * TEXT INTEGER Use atoi() + * TEXT FLOAT Use atof() + * TEXT BLOB No change + * BLOB INTEGER Convert to TEXT then use atoi() + * BLOB FLOAT Convert to TEXT then use atof() + * BLOB TEXT Add a "\000" terminator if needed + * + * Return the value as UTF-8 text. + */ +SWITCH_DECLARE(const unsigned char *)switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol); + +/** + * The first parameter is a compiled SQL statement. This function returns + * the column heading for the Nth column of that statement, where N is the + * second function parameter. The string returned is UTF-8. + */ +SWITCH_DECLARE(const char *)switch_core_db_column_name(switch_core_db_stmt_t *stmt, int N); + +/** + * Return the number of columns in the result set returned by the compiled + * SQL statement. This routine returns 0 if pStmt is an SQL statement + * that does not return data (for example an UPDATE). + */ +SWITCH_DECLARE(int) switch_core_db_column_count(switch_core_db_stmt_t *pStmt); + +/** + * Return a pointer to a UTF-8 encoded string describing in english the + * error condition for the most recent switch_core_db_* API call. The returned + * string is always terminated by an 0x00 byte. + * + * The string "not an error" is returned when the most recent API call was + * successful. + */ +SWITCH_DECLARE(const char *)switch_core_db_errmsg(switch_core_db_t *db); + +/** + * A function to executes one or more statements of SQL. + * + * If one or more of the SQL statements are queries, then + * the callback function specified by the 3rd parameter is + * invoked once for each row of the query result. This callback + * should normally return 0. If the callback returns a non-zero + * value then the query is aborted, all subsequent SQL statements + * are skipped and the switch_core_db_exec() function returns the SWITCH_CORE_DB_ABORT. + * + * The 4th parameter is an arbitrary pointer that is passed + * to the callback function as its first parameter. + * + * The 2nd parameter to the callback function is the number of + * columns in the query result. The 3rd parameter to the callback + * is an array of strings holding the values for each column. + * The 4th parameter to the callback is an array of strings holding + * the names of each column. + * + * The callback function may be NULL, even for queries. A NULL + * callback is not an error. It just means that no callback + * will be invoked. + * + * If an error occurs while parsing or evaluating the SQL (but + * not while executing the callback) then an appropriate error + * message is written into memory obtained from malloc() and + * *errmsg is made to point to that message. The calling function + * is responsible for freeing the memory that holds the error + * message. Use switch_core_db_free() for this. If errmsg==NULL, + * then no error message is ever written. + * + * The return value is is SWITCH_CORE_DB_OK if there are no errors and + * some other return code if there is an error. The particular + * return value depends on the type of error. + * + * If the query could not be executed because a database file is + * locked or busy, then this function returns SWITCH_CORE_DB_BUSY. (This + * behavior can be modified somewhat using the sswitch_core_db_busy_handler() + * and switch_core_db_busy_timeout() functions below.) + */ +SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, + const char *sql, + switch_core_db_callback_func_t callback, + void *data, + char **errmsg); + +/** + * This function is called to delete a compiled + * SQL statement obtained by a previous call to switch_core_db_prepare(). + * If the statement was executed successfully, or + * not executed at all, then SWITCH_CORE_DB_OK is returned. If execution of the + * statement failed then an error code is returned. + * + * This routine can be called at any point during the execution of the + * virtual machine. If the virtual machine has not completed execution + * when this routine is called, that is like encountering an error or + * an interrupt. (See switch_core_db_interrupt().) Incomplete updates may be + * rolled back and transactions cancelled, depending on the circumstances, + * and the result code returned will be SWITCH_CORE_DB_ABORT. + */ +SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt); + +/** + * To execute an SQL query, it must first be compiled into a byte-code + * program using the following routine. + * + * The first parameter "db" is an SQLite database handle. The second + * parameter "zSql" is the statement to be compiled, encoded as + * UTF-8. If the next parameter, "nBytes", is less + * than zero, then zSql is read up to the first nul terminator. If + * "nBytes" is not less than zero, then it is the length of the string zSql + * in bytes (not characters). + * + * *pzTail is made to point to the first byte past the end of the first + * SQL statement in zSql. This routine only compiles the first statement + * in zSql, so *pzTail is left pointing to what remains uncompiled. + * + * *ppStmt is left pointing to a compiled SQL statement that can be + * executed using switch_core_db_step(). Or if there is an error, *ppStmt may be + * set to NULL. If the input text contained no SQL (if the input is and + * empty string or a comment) then *ppStmt is set to NULL. + * + * On success, SWITCH_CORE_DB_OK is returned. Otherwise an error code is returned. + */ +SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db, + const char *zSql, + int nBytes, + switch_core_db_stmt_t **ppStmt, + const char **pzTail); + +/** + * After an SQL query has been compiled with a call to either + * switch_core_db_prepare(), then this function must be + * called one or more times to execute the statement. + * + * The return value will be either SWITCH_CORE_DB_BUSY, SWITCH_CORE_DB_DONE, + * SWITCH_CORE_DB_ROW, SWITCH_CORE_DB_ERROR, or SWITCH_CORE_DB_MISUSE. + * + * SWITCH_CORE_DB_BUSY means that the database engine attempted to open + * a locked database and there is no busy callback registered. + * Call switch_core_db_step() again to retry the open. + * + * SWITCH_CORE_DB_DONE means that the statement has finished executing + * successfully. switch_core_db_step() should not be called again on this virtual + * machine. + * + * If the SQL statement being executed returns any data, then + * SWITCH_CORE_DB_ROW is returned each time a new row of data is ready + * for processing by the caller. The values may be accessed using + * the switch_core_db_column_*() functions described below. switch_core_db_step() + * is called again to retrieve the next row of data. + * + * SWITCH_CORE_DB_ERROR means that a run-time error (such as a constraint + * violation) has occurred. switch_core_db_step() should not be called again on + * the VM. More information may be found by calling switch_core_db_errmsg(). + * + * SWITCH_CORE_DB_MISUSE means that the this routine was called inappropriately. + * Perhaps it was called on a virtual machine that had already been + * finalized or on one that had previously returned SWITCH_CORE_DB_ERROR or + * SWITCH_CORE_DB_DONE. Or it could be the case the the same database connection + * is being used simulataneously by two or more threads. + */ +SWITCH_DECLARE(int) switch_core_db_step(switch_core_db_stmt_t *stmt); + +/** + * Call this routine to free the memory that switch_core_db_get_table() allocated. + */ +SWITCH_DECLARE(void) switch_core_db_free(char *z); + +/** Return values for switch_core_db_exec() and switch_core_db_step()*/ +#define SWITCH_CORE_DB_OK 0 /* Successful result */ +/* beginning-of-error-codes */ +#define SWITCH_CORE_DB_ERROR 1 /* SQL error or missing database */ +#define SWITCH_CORE_DB_INTERNAL 2 /* NOT USED. Internal logic error in SQLite */ +#define SWITCH_CORE_DB_PERM 3 /* Access permission denied */ +#define SWITCH_CORE_DB_ABORT 4 /* Callback routine requested an abort */ +#define SWITCH_CORE_DB_BUSY 5 /* The database file is locked */ +#define SWITCH_CORE_DB_LOCKED 6 /* A table in the database is locked */ +#define SWITCH_CORE_DB_NOMEM 7 /* A malloc() failed */ +#define SWITCH_CORE_DB_READONLY 8 /* Attempt to write a readonly database */ +#define SWITCH_CORE_DB_INTERRUPT 9 /* Operation terminated by switch_core_db_interrupt()*/ +#define SWITCH_CORE_DB_IOERR 10 /* Some kind of disk I/O error occurred */ +#define SWITCH_CORE_DB_CORRUPT 11 /* The database disk image is malformed */ +#define SWITCH_CORE_DB_NOTFOUND 12 /* NOT USED. Table or record not found */ +#define SWITCH_CORE_DB_FULL 13 /* Insertion failed because database is full */ +#define SWITCH_CORE_DB_CANTOPEN 14 /* Unable to open the database file */ +#define SWITCH_CORE_DB_PROTOCOL 15 /* Database lock protocol error */ +#define SWITCH_CORE_DB_EMPTY 16 /* Database is empty */ +#define SWITCH_CORE_DB_SCHEMA 17 /* The database schema changed */ +#define SWITCH_CORE_DB_TOOBIG 18 /* NOT USED. Too much data for one row */ +#define SWITCH_CORE_DB_CONSTRAINT 19 /* Abort due to contraint violation */ +#define SWITCH_CORE_DB_MISMATCH 20 /* Data type mismatch */ +#define SWITCH_CORE_DB_MISUSE 21 /* Library used incorrectly */ +#define SWITCH_CORE_DB_NOLFS 22 /* Uses OS features not supported on host */ +#define SWITCH_CORE_DB_AUTH 23 /* Authorization denied */ +#define SWITCH_CORE_DB_FORMAT 24 /* Auxiliary database format error */ +#define SWITCH_CORE_DB_RANGE 25 /* 2nd parameter to switch_core_db_bind out of range */ +#define SWITCH_CORE_DB_NOTADB 26 /* File opened that is not a database file */ +#define SWITCH_CORE_DB_ROW 100 /* switch_core_db_step() has another row ready */ +#define SWITCH_CORE_DB_DONE 101 /* switch_core_db_step() has finished executing */ +/* end-of-error-codes */ + + +/** @} */ +/** @} */ +/** + * This routine is a variant of the "sprintf()" from the + * standard C library. The resulting string is written into memory + * obtained from malloc() so that there is never a possiblity of buffer + * overflow. This routine also implement some additional formatting + * options that are useful for constructing SQL statements. + * + * The strings returned by this routine should be freed by calling + * switch_core_db_free(). + * + * All of the usual printf formatting options apply. In addition, there + * is a "%q" option. %q works like %s in that it substitutes a null-terminated + * string from the argument list. But %q also doubles every '\'' character. + * %q is designed for use inside a string literal. By doubling each '\'' + * character it escapes that character and allows it to be inserted into + * the string. + * + * For example, so some string variable contains text as follows: + * + * char *zText = "It's a happy day!"; + * + * We can use this text in an SQL statement as follows: + * + * char *z = switch_core_db_mprintf("INSERT INTO TABLES('%q')", zText); + * switch_core_db_exec(db, z, callback1, 0, 0); + * switch_core_db_free(z); + * + * Because the %q format string is used, the '\'' character in zText + * is escaped and the SQL generated is as follows: + * + * INSERT INTO table1 VALUES('It''s a happy day!') + * + * This is correct. Had we used %s instead of %q, the generated SQL + * would have looked like this: + * + * INSERT INTO table1 VALUES('It's a happy day!'); + * + * This second example is an SQL syntax error. As a general rule you + * should always use %q instead of %s when inserting text into a string + * literal. + */ +SWITCH_DECLARE(char *)switch_mprintf(const char *zFormat,...); + +SWITCH_END_EXTERN_C + +#endif + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 10cf6dd74a..c807ea70f5 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -221,13 +221,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se switch_input_args_t *args, uint32_t limit); -/*! - \brief Function to evaluate an expression against a string - \param target The string to find a match in - \param expression The regular expression to run against the string - \return Boolean if a match was found or not -*/ -SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expression); /*! \brief Play a sound and gather digits with the number of retries specified if the user doesn't give digits in the set time diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index f8d1e63f81..7b07cc144d 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -48,6 +48,7 @@ SWITCH_BEGIN_EXTERN_C #define __SWITCH_FUNC__ (const char *)__func__ #endif + #ifdef _MSC_VER @@ -62,7 +63,7 @@ SWITCH_BEGIN_EXTERN_C * C4512: assignment operator could not be generated * C4610: struct can never be instantiated - user defined constructor required */ -#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610) +#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996) #if (_MSC_VER >= 1400) // VC8+ #ifndef _CRT_SECURE_NO_DEPRECATE @@ -93,20 +94,21 @@ typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned long in_addr_t; #endif +typedef int pid_t; +typedef int uid_t; +typedef int gid_t; #define PACKED #include +#define strcasecmp(s1, s2) stricmp(s1, s2) +#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) #else /* packed attribute */ #ifndef PACKED #define PACKED __attribute__ ((__packed__)) #endif -#include -#include -#include #include #include -#include -#include +#include #endif // _MSC_VER #ifndef __LITTLE_ENDIAN @@ -124,6 +126,7 @@ typedef unsigned long in_addr_t; #endif #ifdef WIN32 + #if defined(SWITCH_CORE_DECLARE_STATIC) #define SWITCH_DECLARE(type) type __stdcall #define SWITCH_DECLARE_NONSTD(type) type __cdecl @@ -152,11 +155,13 @@ typedef unsigned long in_addr_t; #ifndef S_IWUSR #define S_IWUSR _S_IWRITE #endif +#define SWITCH_THREAD_FUNC __stdcall #else //not win32 #define SWITCH_DECLARE(type) type #define SWITCH_DECLARE_NONSTD(type) type #define SWITCH_MOD_DECLARE(type) type #define SWITCH_DECLARE_DATA +#define SWITCH_THREAD_FUNC #endif #ifdef DOXYGEN @@ -171,10 +176,115 @@ typedef unsigned long in_addr_t; #define PRINTF_FUNCTION(fmtstr,vars) #endif -SWITCH_END_EXTERN_C +#ifdef SWITCH_INT32 +typedef SWITCH_INT32 switch_int32_t; +#else +typedef int32_t switch_int32_t; +#endif + +#ifdef SWITCH_SIZE_T +typedef SWITCH_SIZE_T switch_size_t; +#else +typedef uintptr_t switch_size_t; +#endif + +#ifdef SWITCH_SSIZE_T +typedef SWITCH_SSIZE_T switch_ssize_t; +#else +typedef intptr_t switch_ssize_t; +#endif + +#ifdef WIN32 + +#ifdef WIN64 +#define SWITCH_SSIZE_T_FMT "%I64d" +#define SWITCH_SIZE_T_FMT "%I64d" +#else +#define SWITCH_SSIZE_T_FMT "%d" +#define SWITCH_SIZE_T_FMT "%d" +#endif + +#define SWITCH_INT64_T_FMT "%I64d" +#define SWITCH_UINT64_T_FMT "%I64u" + +#else +#ifndef SWITCH_SSIZE_T_FMT +#define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "%ld" : sizeof (switch_ssize_t) == sizeof (int) ? "%d" : "%lld") +#endif + +#ifndef SWITCH_SIZE_T_FMT +#define SWITCH_SIZE_T_FMT (sizeof (switch_size_t) == sizeof (long) ? "%lu" : sizeof (switch_size_t) == sizeof (int) ? "%u" : "%llu") +#endif + +#ifndef SWITCH_INT64_T_FMT +#define SWITCH_INT64_T_FMT (sizeof (long) == 8 ? "%ld" : "%lld") +#endif + +#ifndef SWITCH_UINT64_T_FMT +#define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "%lu" : "%llu") +#endif #endif +#define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT + +SWITCH_END_EXTERN_C + +/* these includes must be outside the extern "C" block on windows or it will break compatibility with c++ modules*/ +#ifdef WIN32 +/* Has windows.h already been included? If so, our preferences don't matter, + * but we will still need the winsock things no matter what was included. + * If not, include a restricted set of windows headers to our tastes. + */ +#ifndef _WINDOWS_ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef _WIN32_WINNT + +/* Restrict the server to a subset of Windows NT 4.0 header files by default + */ +#define _WIN32_WINNT 0x0400 +#endif +#ifndef NOUSER +#define NOUSER +#endif +#ifndef NOMCX +#define NOMCX +#endif +#ifndef NOIME +#define NOIME +#endif +#include +/* + * Add a _very_few_ declarations missing from the restricted set of headers + * (If this list becomes extensive, re-enable the required headers above!) + * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now + */ +#define SW_HIDE 0 +#ifndef _WIN32_WCE +#include +#include +#include +#else +#include +#endif +#endif /* !_WINDOWS_ */ +#include +#endif + +#endif + + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE (!FALSE) +#endif + + + /* For Emacs: * Local Variables: * mode:c diff --git a/src/include/switch_private.h.in b/src/include/switch_private.h.in new file mode 100644 index 0000000000..47648313e4 --- /dev/null +++ b/src/include/switch_private.h.in @@ -0,0 +1,158 @@ +/* src/include/switch_private.h.in. Generated from configure.in by autoheader. */ + +/* Enable extra debugging. */ +#undef DEBUG + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `gethostname' function. */ +#undef HAVE_GETHOSTNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mlock' function. */ +#undef HAVE_MLOCK + +/* Define to 1 if you have the `mlockall' function. */ +#undef HAVE_MLOCKALL + +/* Define to 1 if you have the `mmap' function. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strftime' function. */ +#undef HAVE_STRFTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF + +/* Enable Optimization. */ +#undef OPTIMZER + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* The size of a `char', as computed by sizeof. */ +#undef SIZEOF_CHAR + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of size_t */ +#undef SIZEOF_SIZE_T + +/* The size of ssize_t */ +#undef SIZEOF_SSIZE_T + +/* The size of a `void*', as computed by sizeof. */ +#undef SIZEOF_VOIDP + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Little Endian */ +#undef SWITCH_BYTE_ORDER + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* sunpro is bad at inline */ +#undef __inline__ + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t diff --git a/src/include/switch_regex.h b/src/include/switch_regex.h new file mode 100644 index 0000000000..f4e0d6c478 --- /dev/null +++ b/src/include/switch_regex.h @@ -0,0 +1,93 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Michael Jerris + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Michael Jerris + * + * switch_regex.h -- pcre wrapper and extensions Header + * + */ +/*! \file switch_regex.h + \brief Regex Header +*/ +#ifndef SWITCH_REGEX_H +#define SWITCH_REGEX_H + +SWITCH_BEGIN_EXTERN_C + +/** + * @defgroup switch_regex + * @ingroup FREESWITCH + * @{ + */ + +typedef struct real_pcre switch_regex_t; + +SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern, + int options, + const char **errorptr, + int *erroroffset, + const unsigned char *tables); + +SWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject, + int *ovector, + int stringcount, + int stringnumber, + char *buffer, + int size); + +SWITCH_DECLARE(void) switch_regex_free(void *data); + +SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen); +SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector); + +/*! + \brief Function to evaluate an expression against a string + \param target The string to find a match in + \param expression The regular expression to run against the string + \return Boolean if a match was found or not +*/ +SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expression); + +#define switch_regex_safe_free(re) if (re) {\ + switch_regex_free(re);\ + re = NULL;\ + } + +/** @} */ + +SWITCH_END_EXTERN_C + +#endif + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index 431d990b93..c828230719 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -45,7 +45,6 @@ #include SWITCH_BEGIN_EXTERN_C -#include /*! \defgroup resamp Audio Resample Functions diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 43d450305a..1efe285fa8 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -35,7 +35,6 @@ #define SWITCH_TYPES_H #include -#include SWITCH_BEGIN_EXTERN_C #define SWITCH_SEQ_ESC "\033[" @@ -503,7 +502,6 @@ typedef enum { SCSMF_DYNAMIC = (1 << 0) } switch_core_session_message_flag_t; -#define SWITCH_UUID_FORMATTED_LENGTH APR_UUID_FORMATTED_LENGTH #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__ #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__ #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__ @@ -944,6 +942,7 @@ typedef enum { SCSC_CHECK_RUNNING } switch_session_ctl_t; +typedef uint16_t switch_port_t; typedef uint8_t switch_payload_t; typedef struct switch_rtp switch_rtp_t; typedef struct switch_core_session_message switch_core_session_message_t; @@ -1032,7 +1031,6 @@ typedef switch_status_t (*switch_say_callback_t)(switch_core_session_t *session, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args); -typedef int (*switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames); typedef switch_status_t (*switch_module_load_t) (switch_loadable_module_interface_t **, char *); typedef switch_status_t (*switch_module_reload_t) (void); typedef switch_status_t (*switch_module_pause_t) (void); diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 32fbfb8622..ab58c80bb0 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -39,30 +39,15 @@ #define SWITCH_UTILS_H #include -#include SWITCH_BEGIN_EXTERN_C -#ifndef snprintf -#define snprintf apr_snprintf -#endif -#ifndef vsnprintf -#define vsnprintf apr_vsnprintf -#endif - #define switch_bytes_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval))) #define SWITCH_SMAX 32767 #define SWITCH_SMIN -32768 #define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX / 2; else if (n < SWITCH_SMIN) n = SWITCH_SMIN / 2; -SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in); - -SWITCH_DECLARE(apr_status_t) switch_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len); - - #define switch_codec2str(codec,buf,len) snprintf(buf, len, "%s@%uk@%ui", \ codec->implementation->iananame, \ codec->implementation->samples_per_second, \ @@ -133,10 +118,6 @@ SWITCH_DECLARE(unsigned char) switch_char_to_rfc2833(char key); */ #define is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) -/*! - \brief Duplicate a string -*/ -#define switch_copy_string apr_cpystrn /*! \brief Test for the existance of a flag on an arbitary object @@ -209,13 +190,7 @@ switch_mutex_unlock(obj->flag_mutex); /*! \brief Wait a desired number of microseconds and yield the CPU */ -#if defined(HAVE_USLEEP) -#define switch_yield(ms) usleep(ms); -#elif defined(WIN32) -#define switch_yield(ms) Sleep((DWORD)((ms) / 1000)); -#else -#define switch_yield(ms) apr_sleep(ms); //apr_thread_yield(); -#endif +#define switch_yield(ms) switch_sleep(ms); /*! \brief Converts a string representation of a date into a switch_time_t @@ -252,16 +227,6 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char */ SWITCH_DECLARE(char *) switch_escape_char(switch_memory_pool_t *pool, char *in, char *delim, char esc); -/*! - \brief Create a set of file descriptors to poll - \param poll the polfd to create - \param sock the socket to add - \param flags the flags to modify the behaviour - \param pool the memory pool to use - \return SWITCH_STATUS_SUCCESS when successful -*/ -SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, switch_int16_t flags, switch_memory_pool_t *pool); - /*! \brief Wait for a socket \param poll the pollfd to wait on @@ -276,20 +241,12 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms); */ SWITCH_DECLARE(const char *) switch_cut_path(const char *in); -#define switch_clean_re(re) if (re) {\ - pcre_free(re);\ - re = NULL;\ - } - SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *search, const char *replace); SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len); -SWITCH_DECLARE(int) switch_perform_regex(char *field, char *expression, pcre **new_re, int *ovector, uint32_t olen); -SWITCH_DECLARE(void) switch_perform_substitution(pcre *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector); #define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len); SWITCH_DECLARE(char *) switch_url_decode(char *s); -SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename); SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index a36c0d7fa4..f3c06a4edc 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -55,11 +55,7 @@ #ifndef _SWITCH_XML_H #define _SWITCH_XML_H -#include -#include -#include -#include -#include +#include ///\defgroup xml1 XML Library Functions diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f1ebedfea2..a7b537ad60 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -374,7 +374,7 @@ static switch_status_t strepoch_api_function(char *data, switch_core_session_t * out = switch_str_time(data); } - stream->write_function(stream, "%d", (uint32_t)apr_time_sec(out)); + stream->write_function(stream, "%d", (uint32_t)((out) / (int64_t)(1000000)) ); return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 4c8004e42c..629f06ad4b 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -315,16 +315,16 @@ static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr * } if (flags && service && regex && replace) { - pcre *re = NULL; + switch_regex_t *re = NULL; int proceed = 0, ovector[30]; char substituted[1024] = ""; char rbuf[1024] = ""; char *uri; enum_route_t *route; - switch_clean_re(re); + switch_regex_safe_free(re); - if ((proceed = switch_perform_regex(q->number, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if ((proceed = switch_regex_perform(q->number, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { if (strchr(regex, '(')) { switch_perform_substitution(re, proceed, replace, q->number, substituted, sizeof(substituted), ovector); uri = substituted; @@ -333,8 +333,8 @@ static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr * } if ((route = (enum_route_t *) switch_core_hash_find(globals.routes, service))){ - switch_clean_re(re); - if ((proceed = switch_perform_regex(uri, route->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + switch_regex_safe_free(re); + if ((proceed = switch_regex_perform(uri, route->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { if (strchr(route->regex, '(')) { switch_perform_substitution(re, proceed, route->replace, uri, rbuf, sizeof(rbuf), ovector); uri = rbuf; @@ -347,7 +347,7 @@ static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr * add_result(q, order, preference, service, uri); } - switch_clean_re(re); + switch_regex_safe_free(re); } break; diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index bc18734ee7..af5397c1ec 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -63,7 +63,7 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit char *do_break_a = NULL; char *expression = NULL; char *field_data = NULL; - pcre *re = NULL; + switch_regex_t *re = NULL; int ovector[30]; break_t do_break_i = BREAK_ON_FALSE; @@ -118,7 +118,7 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit field_data = ""; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "test conditions %s(%s) =~ /%s/\n", field, field_data, expression); - if (!(proceed = switch_perform_regex(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if (!(proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex mismatch\n"); for (xaction = switch_xml_child(xcond, "anti-action"); xaction; xaction = xaction->next) { @@ -181,7 +181,7 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit switch_safe_free(substituted); } - switch_clean_re(re); + switch_regex_safe_free(re); if (do_break_i == BREAK_ON_TRUE || do_break_i == BREAK_ALWAYS) { break; diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 0fe30287f7..7b0b8e693e 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -363,7 +363,7 @@ static void pres_event_handler(switch_event_t *event) type, rpid, status, proto, from); - for (hi = switch_hash_first(apr_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { char *errmsg; switch_hash_this(hi, NULL, NULL, &val); profile = (struct mdl_profile *) val; @@ -462,7 +462,7 @@ static void roster_event_handler(switch_event_t *event) sql = switch_mprintf("select *,'%q' from subscriptions", status ? status : ""); } - for (hi = switch_hash_first(apr_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { char *errmsg; switch_hash_this(hi, NULL, NULL, &val); profile = (struct mdl_profile *) val; @@ -537,7 +537,7 @@ static void sign_off(void) sql = switch_mprintf("select * from subscriptions"); - for (hi = switch_hash_first(apr_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { char *errmsg; switch_hash_this(hi, NULL, NULL, &val); profile = (struct mdl_profile *) val; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index b323490d8c..8cdcded86a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -717,7 +717,7 @@ static void set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, c snprintf(buf, sizeof(buf), "v=0\n" - "o=FreeSWITCH %d%"APR_TIME_T_FMT" %d%"APR_TIME_T_FMT" IN IP4 %s\n" + "o=FreeSWITCH %d%"SWITCH_TIME_T_FMT" %d%"SWITCH_TIME_T_FMT" IN IP4 %s\n" "s=FreeSWITCH\n" "c=IN IP4 %s\n" "t=0 0\n" @@ -3219,13 +3219,13 @@ static char *get_auth_data(char *dbname, char *nonce, char *npassword, size_t le while (running < 5000) { int result = switch_core_db_step(stmt); - if (result == SQLITE_ROW) { + if (result == SWITCH_CORE_DB_ROW) { if ((colcount = switch_core_db_column_count(stmt))) { switch_copy_string(npassword, (char *)switch_core_db_column_text(stmt, 0), len); ret = npassword; } break; - } else if (result == SQLITE_BUSY) { + } else if (result == SWITCH_CORE_DB_BUSY) { running++; switch_yield(1000); continue; @@ -5639,7 +5639,7 @@ static void cancel_presence(void) void *val; if ((sql = switch_mprintf("select 0,'unavailable','unavailable',* from sip_subscriptions where event='presence'"))) { - for (hi = switch_hash_first(apr_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, NULL, NULL, &val); profile = (sofia_profile_t *) val; if (!(profile->pflags & PFLAG_PRESENCE)) { @@ -5773,7 +5773,7 @@ static void pres_event_handler(switch_event_t *event) sql = switch_mprintf("select 1,'%q','%q',* from sip_subscriptions where event='presence'", status, rpid); } - for (hi = switch_hash_first(apr_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, NULL, NULL, &val); profile = (sofia_profile_t *) val; if (!(profile->pflags & PFLAG_PRESENCE)) { @@ -5872,7 +5872,7 @@ static void pres_event_handler(switch_event_t *event) break; } - for (hi = switch_hash_first(apr_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, NULL, NULL, &val); profile = (sofia_profile_t *) val; if (!(profile->pflags & PFLAG_PRESENCE)) { diff --git a/src/mod/endpoints/mod_woomera/mod_woomera.c b/src/mod/endpoints/mod_woomera/mod_woomera.c index 2965853dca..a020210378 100644 --- a/src/mod/endpoints/mod_woomera/mod_woomera.c +++ b/src/mod/endpoints/mod_woomera/mod_woomera.c @@ -117,7 +117,7 @@ struct woomera_event_queue { struct woomera_profile { char *name; switch_socket_t *woomera_socket; - apr_thread_mutex_t *iolock; + switch_mutex_t *iolock; char woomera_host[WOOMERA_STRLEN]; switch_port_t woomera_port; char audio_ip[WOOMERA_STRLEN]; @@ -134,9 +134,9 @@ struct private_object { switch_codec_t read_codec; switch_codec_t write_codec; switch_core_session_t *session; - switch_pollfd_t read_poll; - switch_pollfd_t write_poll; - switch_pollfd_t command_poll; + switch_pollfd_t *read_poll; + switch_pollfd_t *write_poll; + switch_pollfd_t *command_poll; char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE]; switch_mutex_t *iolock; switch_sockaddr_t *udpread; @@ -306,7 +306,7 @@ static void woomera_socket_close(switch_socket_t **socket) static void udp_socket_close(struct private_object *tech_pvt) { if (tech_pvt->udp_socket) { - apr_socket_shutdown(tech_pvt->udp_socket, APR_SHUTDOWN_READWRITE); + switch_socket_shutdown(tech_pvt->udp_socket, SWITCH_SHUTDOWN_READWRITE); woomera_socket_close(&tech_pvt->udp_socket); } } @@ -364,7 +364,7 @@ static switch_status_t woomera_waitfor_read(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - return switch_socket_waitfor(&tech_pvt->read_poll, ms) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS; + return switch_socket_waitfor(tech_pvt->read_poll, ms) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS; } static switch_status_t woomera_waitfor_write(switch_core_session_t *session, int ms, int stream_id) @@ -375,7 +375,7 @@ static switch_status_t woomera_waitfor_write(switch_core_session_t *session, int assert(tech_pvt != NULL); return SWITCH_STATUS_SUCCESS; -// return switch_socket_waitfor(&tech_pvt->write_poll, ms); +// return switch_socket_waitfor(tech_pvt->write_poll, ms); } static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, diff --git a/src/mod/event_handlers/mod_cdr/basecdr.h b/src/mod/event_handlers/mod_cdr/basecdr.h index dd249272d8..bd93038fd0 100644 --- a/src/mod/event_handlers/mod_cdr/basecdr.h +++ b/src/mod/event_handlers/mod_cdr/basecdr.h @@ -65,7 +65,7 @@ enum switch_mod_cdr_sql_types_t { CDR_INTEGER,CDR_STRING,CDR_DECIMAL,CDR_DOUBLE, #define STDCALL #endif -typedef apr_status_t (STDCALL *modcdr_time_convert_t)(apr_time_exp_t*,apr_time_t); +typedef switch_status_t (STDCALL *modcdr_time_convert_t)(switch_time_exp_t*,switch_time_t); class BaseCDR { public: diff --git a/src/mod/event_handlers/mod_cdr/csvcdr.cpp b/src/mod/event_handlers/mod_cdr/csvcdr.cpp index f00c4f325f..c3b4756bfc 100644 --- a/src/mod/event_handlers/mod_cdr/csvcdr.cpp +++ b/src/mod/event_handlers/mod_cdr/csvcdr.cpp @@ -67,7 +67,7 @@ CsvCDR::CsvCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel) convert_time(&tempcallend, callenddate); // Format the times - apr_size_t retsizecsd, retsizecad, retsizectd, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile + switch_size_t retsizecsd, retsizecad, retsizectd, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile char format[] = "%Y-%m-%d %H:%M:%S"; switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart); switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer); @@ -213,7 +213,7 @@ void CsvCDR::open_file() switch_time_exp_lt(&now_converted,now); - apr_size_t retsize; + switch_size_t retsize; char format[] = "%Y-%m-%d-%H-%M-%S"; char formatteddate[100]; memset(formatteddate,0,100); diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index dbb194562d..cfc62fe08f 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -65,10 +65,10 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings) char *next, *cur; uint32_t count = 0; uint8_t custom = 0; - apr_ssize_t hlen = APR_HASH_KEY_STRING; + switch_ssize_t hlen = SWITCH_HASH_KEY_STRING; gethostname(globals.hostname, sizeof(globals.hostname)); - globals.host_hash = apr_hashfunc_default(globals.hostname, &hlen); + globals.host_hash = switch_hashfunc_default(globals.hostname, &hlen); globals.key_count = 0; if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { @@ -256,7 +256,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void) { int x = 0; - switch_socket_shutdown(globals.udp_socket, APR_SHUTDOWN_READWRITE); + switch_socket_shutdown(globals.udp_socket, SWITCH_SHUTDOWN_READWRITE); globals.running = -1; while(x < 100000 && globals.running) { x++; diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 1c332d1d09..3e1092da72 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -194,7 +194,7 @@ static void socket_function(switch_core_session_t *session, char *data) return; } - if (switch_socket_create(&new_sock, AF_INET, SOCK_STREAM, APR_PROTO_TCP, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + if (switch_socket_create(&new_sock, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error!\n"); return; } @@ -271,7 +271,7 @@ static switch_loadable_module_interface_t event_socket_module_interface = { static void close_socket(switch_socket_t **sock) { switch_mutex_lock(listen_list.sock_mutex); if (*sock) { - apr_socket_shutdown(*sock, APR_SHUTDOWN_READWRITE); + switch_socket_shutdown(*sock, SWITCH_SHUTDOWN_READWRITE); switch_socket_close(*sock); *sock = NULL; } @@ -449,7 +449,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (data) { - snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", strlen(data)); + snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"SWITCH_SSIZE_T_FMT"\n\n", strlen(data)); len = strlen(buf); switch_socket_send(listener->sock, buf, &len); len = strlen(data); @@ -486,7 +486,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, len = strlen(listener->ebuf); - snprintf(hbuf, sizeof(hbuf), "Content-Length: %"APR_SSIZE_T_FMT"\n" + snprintf(hbuf, sizeof(hbuf), "Content-Length: %"SWITCH_SSIZE_T_FMT"\n" "Content-Type: text/event-%s\n" "\n", len, etype); @@ -558,7 +558,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj) switch_size_t rlen, blen; char buf[1024] = ""; rlen = strlen(reply); - snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", rlen); + snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %"SWITCH_SSIZE_T_FMT"\n\n", rlen); blen = strlen(buf); switch_socket_send(acs->listener->sock, buf, &blen); switch_socket_send(acs->listener->sock, reply, &rlen); @@ -1006,7 +1006,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n"); - switch_socket_opt_set(listener->sock, APR_SO_NONBLOCK, TRUE); + switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE); switch_set_flag_locked(listener, LFLAG_RUNNING); add_listener(listener); @@ -1210,9 +1210,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void) for(;;) { - rv = switch_sockaddr_info_get(&sa, prefs.ip, APR_INET, prefs.port, 0, pool); + rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool); if (rv) goto fail; - rv = switch_socket_create(&listen_list.sock, sa->family, SOCK_STREAM, APR_PROTO_TCP, pool); + rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool); if (rv) goto sock_fail; rv = switch_socket_opt_set(listen_list.sock, SWITCH_SO_REUSEADDR, 1); if (rv) goto sock_fail; diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index fa133fb5a6..c22527dca4 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -438,9 +438,9 @@ static void js_error(JSContext *cx, const char *message, JSErrorReport *report) static switch_status_t sm_load_file(char *filename) { sm_loadable_module_t *module = NULL; - apr_dso_handle_t *dso = NULL; - apr_status_t status = SWITCH_STATUS_SUCCESS; - apr_dso_handle_sym_t function_handle = NULL; + switch_dso_handle_t *dso = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_dso_handle_sym_t function_handle = NULL; spidermonkey_init_t spidermonkey_init = NULL; const sm_module_interface_t *module_interface = NULL, *mp; @@ -450,16 +450,16 @@ static switch_status_t sm_load_file(char *filename) assert(filename != NULL); - status = apr_dso_load(&dso, filename, module_manager.pool); + status = switch_dso_load(&dso, filename, module_manager.pool); while (loading) { - if (status != APR_SUCCESS) { - apr_dso_error(dso, derr, sizeof(derr)); + if (status != SWITCH_STATUS_SUCCESS) { + switch_dso_error(dso, derr, sizeof(derr)); err = derr; break; } - status = apr_dso_sym(&function_handle, dso, "spidermonkey_init"); + status = switch_dso_sym(&function_handle, dso, "spidermonkey_init"); spidermonkey_init = (spidermonkey_init_t)(intptr_t) function_handle; if (spidermonkey_init == NULL) { diff --git a/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c b/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c index 0601f28d01..bfce4ac509 100644 --- a/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c +++ b/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c @@ -153,10 +153,10 @@ static JSBool db_next(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv int running = 1; while (running < 5000) { int result = switch_core_db_step(dbo->stmt); - if (result == SQLITE_ROW) { + if (result == SWITCH_CORE_DB_ROW) { *rval = BOOLEAN_TO_JSVAL( JS_TRUE ); break; - } else if (result == SQLITE_BUSY) { + } else if (result == SWITCH_CORE_DB_BUSY) { running++; continue; } diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index c2f8d43a3a..b967d30eb4 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -134,13 +134,7 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, const c char *data; va_start(ap, fmt); -#ifdef HAVE_VASPRINTF - ret = vasprintf(&data, fmt, ap); -#else - if ((data = (char *) malloc(2048))) { - vsnprintf(data, 2048, fmt, ap); - } -#endif + ret = switch_vasprintf(&data, fmt, ap); va_end(ap); if (data) { diff --git a/src/switch_apr.c b/src/switch_apr.c new file mode 100644 index 0000000000..52ee2372e5 --- /dev/null +++ b/src/switch_apr.c @@ -0,0 +1,675 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/F + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Michael Jerris + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Michael Jerris + * + * + * switch_apr.c -- apr wrappers and extensions + * + */ + +#include +#ifndef WIN32 +#include +#endif + +/* apr headers*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define APR_WANT_STDIO +#define APR_WANT_STRFUNC +#include + +/* apr_vformatter_buff_t definition*/ +#include + +/* apr-util headers */ +#include +#include + +/* apr stubs */ + +/* Memory Pools */ + +SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p) +{ + apr_pool_clear(p); +} + +/* Hash tables */ + +SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t *ht) +{ + return apr_hash_first(p, ht); +} + +SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *ht) +{ + return apr_hash_next(ht); +} + +SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val) +{ + apr_hash_this(hi, key, klen, val); +} + +SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen) +{ + return apr_hashfunc_default(key, klen); +} + +SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht) +{ + return apr_hash_pool_get(ht); +} + +/* DSO functions */ + +SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, + const char *path, switch_memory_pool_t *ctx) +{ + return apr_dso_load(res_handle, path, ctx); +} + +SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t *handle) +{ + return apr_dso_unload(handle); +} + +SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t *ressym, + switch_dso_handle_t *handle, + const char *symname) +{ + return apr_dso_sym(ressym, handle, symname); +} + +SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *buf, size_t bufsize) +{ + return apr_dso_error(dso, buf, bufsize); +} + + +/* string functions */ + +SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, + switch_size_t *retsize, + switch_size_t max, + const char *format, + switch_time_exp_t *tm) +{ + return apr_strftime(s, retsize, max, format, (apr_time_exp_t *)tm); +} + +SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *format, ...) +{ + va_list ap; + int ret; + va_start(ap, format); + ret = apr_vsnprintf(buf, len, format, ap); + va_end(ap); + return ret; +} + +SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap) +{ + return apr_vsnprintf(buf, len, format, ap); +} + +SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size) +{ + return apr_cpystrn(dst, src, dst_size); +} + +/* thread read write lock functions */ + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, + switch_memory_pool_t *pool) +{ + return apr_thread_rwlock_create(rwlock, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_destroy(rwlock); +} + +SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_pool_get(rwlock); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_rdlock(rwlock); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_tryrdlock(rwlock); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_wrlock(rwlock); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_trywrlock(rwlock); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock) +{ + return apr_thread_rwlock_unlock(rwlock); +} + +/* thread mutex functions */ + +SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, + unsigned int flags, + switch_memory_pool_t *pool) +{ + return apr_thread_mutex_create(lock, flags, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock) +{ + return apr_thread_mutex_destroy(lock); +} + +SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock) +{ + return apr_thread_mutex_lock(lock); +} + +SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock) +{ + return apr_thread_mutex_unlock(lock); +} + +SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock) +{ + return apr_thread_mutex_trylock(lock); +} + +/* time function stubs */ + +SWITCH_DECLARE(switch_time_t) switch_time_now(void) +{ + return (switch_time_t)apr_time_now(); +} + +SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input) +{ + return apr_time_exp_gmt_get(result, (apr_time_exp_t *)input); +} + +SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input) +{ + return apr_time_exp_get(result, (apr_time_exp_t *)input); +} + +SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input) +{ + return apr_time_exp_lt((apr_time_exp_t *)result, input); +} + +SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input) +{ + return apr_time_exp_gmt((apr_time_exp_t *)result, input); +} + +SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t) +{ +#if defined(HAVE_USLEEP) + usleep(t); +#elif defined(WIN32) + Sleep((DWORD)((t) / 1000)); +#else + apr_sleep(t); +#endif +} + + +SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t) +{ + return apr_rfc822_date(date_str, t); +} + +SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec) +{ + return ((switch_time_t)(sec) * APR_USEC_PER_SEC + (switch_time_t)(usec)); +} + + +/* Thread condition locks */ + +SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool) +{ + return apr_thread_cond_create(cond, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex) +{ + return apr_thread_cond_wait(cond, mutex); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout) +{ + return apr_thread_cond_timedwait(cond, mutex, timeout); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond) +{ + return apr_thread_cond_signal(cond); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond) +{ + return apr_thread_cond_broadcast(cond); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond) +{ + return apr_thread_cond_destroy(cond); +} + +/* file i/o stubs */ + +SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm, switch_memory_pool_t *pool) +{ + return apr_file_open(newf, fname, flag, perm, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset) +{ + apr_status_t rv; + apr_off_t off = (apr_off_t)(*offset); + rv = apr_file_seek(thefile, where, &off); + *offset = (int64_t)off; + return rv; +} + +SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile) +{ + return apr_file_close(thefile); +} + +SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool) +{ + return apr_file_remove(path, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes) +{ + return apr_file_read(thefile, buf, nbytes); +} + +SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes) +{ + return apr_file_write(thefile, buf, nbytes); +} + +SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename) +{ + int32_t wanted = APR_FINFO_TYPE; + apr_finfo_t info = {0}; + if (filename) { + apr_stat(&info, filename, wanted, NULL); + if (info.filetype != APR_NOFILE) { + return SWITCH_STATUS_SUCCESS; + } + } + return SWITCH_STATUS_FALSE; +} + +/* thread stubs */ + + +SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool) +{ + return apr_threadattr_create(new_attr, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on) +{ + return apr_threadattr_detach_set(attr, on); +} + +SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize) +{ + return apr_threadattr_stacksize_set(attr, stacksize); +} + +SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont) +{ + return apr_thread_create(new_thread, attr, func, data, cont); +} + +/* socket stubs */ + +SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool) +{ + return apr_socket_create(new_sock, family, type, protocol, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how) +{ + return apr_socket_shutdown(sock, how); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock) +{ + return apr_socket_close(sock); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog) +{ + return apr_socket_listen(sock, backlog); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool) +{ + return apr_socket_accept(new_sock, sock, pool); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} + + +SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} + +SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool) +{ + return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool); +} + + +SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on) +{ + return apr_socket_opt_set(sock, opt, on); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t) +{ + return apr_socket_timeout_set(sock, t); +} + +SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa) +{ + return apr_sockaddr_ip_get(addr, sa); +} + +SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source) +{ + return apr_mcast_join(sock, join, iface, source); +} + + +/* socket functions */ + +SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in) +{ + return get_addr(buf, len, &in->sa.sin.sin_addr); +} + + +SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa) +{ + return sa->port; +} + +SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa) +{ + return sa->family; +} + +SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, + int32_t flags, char *buf, + size_t *len) +{ + apr_status_t r; + + if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) { + from->port = ntohs(from->sa.sin.sin_port); + /* from->ipaddr_ptr = &(from->sa.sin.sin_addr); + * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr); + */ + } + + return r; + +} + +/* poll stubs */ + +SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, + uint32_t size, + switch_memory_pool_t *p, + uint32_t flags) +{ + return apr_pollset_create(pollset, size, p, flags); +} + +SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, + const switch_pollfd_t *descriptor) +{ + return apr_pollset_add(pollset, descriptor); +} + +SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, + int32_t numsock, + int32_t *nsds, + switch_interval_time_t timeout) +{ + return apr_poll(aprset, numsock, nsds, timeout); +} + +SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, + int16_t flags, switch_memory_pool_t *pool) +{ + switch_pollset_t *pollset; + + void *ptr = NULL; + + if ((ptr = apr_palloc(pool, sizeof(switch_pollfd_t))) == 0) { + return SWITCH_STATUS_MEMERR; + } + + if (switch_pollset_create(&pollset, 1, pool, flags) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_GENERR; + } + + memset(ptr, 0, sizeof(switch_pollfd_t)); + *poll = ptr; + + (*poll)->desc_type = APR_POLL_SOCKET; + (*poll)->reqevents = flags; + (*poll)->desc.s = sock; + (*poll)->client_data = sock; + + if (switch_pollset_add(pollset, *poll) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_GENERR; + } + + return SWITCH_STATUS_SUCCESS; +} + + + + + +/* apr-util stubs */ + +/* UUID Handling (apr-util) */ + + +SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid) +{ + apr_uuid_format(buffer, (const apr_uuid_t *)uuid); +} + +SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid) +{ + apr_uuid_get((apr_uuid_t *)uuid); +} + +SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str) +{ + return apr_uuid_parse((apr_uuid_t *)uuid, uuid_str); +} + + +/* FIFO queues (apr-util) */ + +SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, + unsigned int queue_capacity, + switch_memory_pool_t *pool) +{ + return apr_queue_create(queue, queue_capacity, pool); +} + +SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue) +{ + return apr_queue_size(queue); +} + +SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data) +{ + return apr_queue_pop(queue, data); +} + +SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data) +{ + return apr_queue_push(queue, data); +} + +SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data) +{ + return apr_queue_trypop(queue, data); +} + +SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data) +{ + return apr_queue_trypush(queue, data); +} + +#if 0 +/* Utility functions */ +struct switch_vasprintf_data { + apr_vformatter_buff_t vbuff; + switch_size_t len; + switch_size_t block_size; + char *buf; +}; + +static int vasprintf_flush(apr_vformatter_buff_t *buff) +{ + struct switch_vasprintf_data *data = (struct switch_vasprintf_data *)buff; + + char *temp; + switch_size_t len = data->vbuff.curpos - data->buf; + + if ((temp = realloc(data->buf, data->len + data->block_size))) { + data->buf = temp; + data->vbuff.curpos = data->buf + len; + data->len = data->len + data->block_size; + data->vbuff.endpos = data->buf + data->len; + return 0; + } + + return -1; +} +#endif + +SWITCH_DECLARE(int) switch_vasprintf(char **buf, const char *format, va_list ap) +{ +#if 0 + struct switch_vasprintf_data data; + + data.block_size = 1024; + data.buf = malloc(data.block_size); + + if (data.buf == NULL) { + *buf = NULL; + return 0; + } + + data.vbuff.curpos = data.buf; + data.vbuff.endpos = data.buf + data.block_size; + + return apr_vformatter(vasprintf_flush, (apr_vformatter_buff_t *)&data, format, ap); +#endif +#ifdef HAVE_VASPRINTF + return vasprintf(buf, format, ap); +#else + *buf = (char *) malloc(2048); + return vsnprintf(*buf, 2048, format, ap); +#endif +} + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/switch_console.c b/src/switch_console.c index 380757d32f..cd61ce413b 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -48,13 +48,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle } va_start(ap, fmt); -#ifdef HAVE_VASPRINTF - ret = vasprintf(&data, fmt, ap); -#else - if ((data = (char *) malloc(2048))) { - ret = vsnprintf(data, 2048, fmt, ap); - } -#endif + ret = switch_vasprintf(&data, fmt, ap); va_end(ap); if (data) { @@ -145,12 +139,7 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const handle = switch_core_data_channel(channel); -#ifdef HAVE_VASPRINTF - ret = vasprintf(&data, fmt, ap); -#else - data = (char *) malloc(2048); - ret = vsnprintf(data, 2048, fmt, ap); -#endif + ret = switch_vasprintf(&data, fmt, ap); va_end(ap); if (ret == -1) { fprintf(stderr, "Memory Error\n"); diff --git a/src/switch_core.c b/src/switch_core.c index 05df61e818..2544d50ae6 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -33,8 +33,31 @@ */ #include -#include #include +#ifndef WIN32 +#include +#endif + +/* for apr_pool_create and apr_pool_destroy */ +/* functions only used in this file so not exposed */ +#include + +/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */ +/* functions only used in this file so not exposed */ +#include + +/* for apr_pvsprintf */ +/* function only used in this file so not exposed */ +#include + +/* for apr_initialize and apr_terminate */ +/* function only used in this file so not exposed */ +#include + +#include +typedef apr_os_thread_t switch_thread_id_t; +#define switch_thread_self apr_os_thread_current + #ifdef HAVE_MLOCKALL #include diff --git a/src/switch_core_db.c b/src/switch_core_db.c new file mode 100644 index 0000000000..0a60065c34 --- /dev/null +++ b/src/switch_core_db.c @@ -0,0 +1,118 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Michael Jerris + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Michael Jerris + * + * + * switch_core_db.c -- sqlite wrapper and extensions + * + */ + +#include +#include + +SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb) +{ + return sqlite3_open(filename, ppDb); +} + +SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db) +{ + return sqlite3_close(db); +} + +SWITCH_DECLARE(const unsigned char *)switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol) +{ + return sqlite3_column_text(stmt, iCol); +} + +SWITCH_DECLARE(const char *)switch_core_db_column_name(switch_core_db_stmt_t *stmt, int N) +{ + return sqlite3_column_name(stmt, N); +} + +SWITCH_DECLARE(int) switch_core_db_column_count(switch_core_db_stmt_t *pStmt) +{ + return sqlite3_column_count(pStmt); +} + +SWITCH_DECLARE(const char *)switch_core_db_errmsg(switch_core_db_t *db) +{ + return sqlite3_errmsg(db); +} + +SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, + const char *sql, + switch_core_db_callback_func_t callback, + void *data, + char **errmsg) +{ + return sqlite3_exec(db, sql, callback, data, errmsg); +} + +SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt) +{ + return sqlite3_finalize(pStmt); +} + +SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db, + const char *zSql, + int nBytes, + switch_core_db_stmt_t **ppStmt, + const char **pzTail) +{ + return sqlite3_prepare(db, zSql, nBytes, ppStmt, pzTail); +} + +SWITCH_DECLARE(int) switch_core_db_step(switch_core_db_stmt_t *stmt) +{ + return sqlite3_step(stmt); +} + +SWITCH_DECLARE(void) switch_core_db_free(char *z) +{ + sqlite3_free(z); +} + +SWITCH_DECLARE(char *)switch_mprintf(const char *zFormat,...) +{ + va_list ap; + char *z; + va_start(ap, zFormat); + z = sqlite3_vmprintf(zFormat, ap); + va_end(ap); + return z; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/switch_event.c b/src/switch_event.c index 3d7652ff42..95df6bdd97 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -532,12 +532,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, con va_list ap; if (fmt) { va_start(ap, fmt); -#ifdef HAVE_VASPRINTF - ret = vasprintf(&data, fmt, ap); -#else - data = (char *) malloc(2048); - ret = vsnprintf(data, 2048, fmt, ap); -#endif + ret = switch_vasprintf(&data, fmt, ap); va_end(ap); if (ret == -1) { diff --git a/src/switch_ivr.c b/src/switch_ivr.c index d4119127ce..053d126795 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -92,10 +92,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_t *channel = switch_core_session_get_channel(session); char *cmd = switch_event_get_header(event, "call-command"); unsigned long cmd_hash; - apr_ssize_t hlen = APR_HASH_KEY_STRING; - unsigned long CMD_EXECUTE = apr_hashfunc_default("execute", &hlen); - unsigned long CMD_HANGUP = apr_hashfunc_default("hangup", &hlen); - unsigned long CMD_NOMEDIA = apr_hashfunc_default("nomedia", &hlen); + switch_ssize_t hlen = SWITCH_HASH_KEY_STRING; + unsigned long CMD_EXECUTE = switch_hashfunc_default("execute", &hlen); + unsigned long CMD_HANGUP = switch_hashfunc_default("hangup", &hlen); + unsigned long CMD_NOMEDIA = switch_hashfunc_default("nomedia", &hlen); assert(channel != NULL); assert(event != NULL); @@ -106,7 +106,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se } hlen = (switch_size_t) strlen(cmd); - cmd_hash = apr_hashfunc_default(cmd, &hlen); + cmd_hash = switch_hashfunc_default(cmd, &hlen); switch_channel_set_flag(channel, CF_EVENT_PARSE); @@ -1476,50 +1476,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess return status; } -SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expression) { - const char* error = NULL; //Used to hold any errors - int error_offset = 0; //Holds the offset of an error - pcre* pcre_prepared = NULL; //Holds the compiled regex - int match_count = 0; //Number of times the regex was matched - int offset_vectors[2]; //not used, but has to exist or pcre won't even try to find a match - - //Compile the expression - pcre_prepared = pcre_compile(expression, 0, &error, &error_offset, NULL); - - //See if there was an error in the expression - if (error != NULL) { - //Clean up after ourselves - if (pcre_prepared) { - pcre_free(pcre_prepared); - pcre_prepared = NULL; - } - - //Note our error - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Regular Expression Error expression[%s] error[%s] location[%d]\n", expression, error, error_offset); - - //We definitely didn't match anything - return SWITCH_STATUS_FALSE; - } - - //So far so good, run the regex - match_count = pcre_exec(pcre_prepared, NULL, target, (int) strlen(target), 0, 0, offset_vectors, sizeof(offset_vectors) / sizeof(offset_vectors[0])); - - //Clean up - if (pcre_prepared) { - pcre_free(pcre_prepared); - pcre_prepared = NULL; - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number of matches: %d\n", match_count); - - //Was it a match made in heaven? - if (match_count > 0) { - return SWITCH_STATUS_SUCCESS; - } else { - return SWITCH_STATUS_FALSE; - } -} - SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t *session, uint32_t min_digits, uint32_t max_digits, @@ -4830,7 +4786,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s char *pattern = (char *) switch_xml_attr(input, "pattern"); if (pattern) { - pcre *re = NULL; + switch_regex_t *re = NULL; int proceed = 0, ovector[30]; char *substituted = NULL; uint32_t len = 0; @@ -4838,7 +4794,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s char *expanded = NULL; switch_xml_t match = NULL; - if ((proceed = switch_perform_regex(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if ((proceed = switch_regex_perform(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { match = switch_xml_child(input, "match"); } else { match = switch_xml_child(input, "nomatch"); @@ -4854,7 +4810,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s len = (uint32_t)(strlen(data) + strlen(adata) + 10); if (!(substituted = malloc(len))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); - switch_clean_re(re); + switch_regex_safe_free(re); switch_safe_free(expanded); goto done; } @@ -4907,7 +4863,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s } } - switch_clean_re(re); + switch_regex_safe_free(re); switch_safe_free(expanded); switch_safe_free(substituted); } @@ -5111,25 +5067,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ if (!(time_tag = switch_xml_add_child_d(x_times, "created_time", t_off++))) { goto error; } - snprintf(tmp, sizeof(tmp), "%"APR_TIME_T_FMT, caller_profile->times->created); + snprintf(tmp, sizeof(tmp), "%"SWITCH_TIME_T_FMT, caller_profile->times->created); switch_xml_set_txt_d(time_tag, tmp); if (!(time_tag = switch_xml_add_child_d(x_times, "answered_time", t_off++))) { goto error; } - snprintf(tmp, sizeof(tmp), "%"APR_TIME_T_FMT, caller_profile->times->answered); + snprintf(tmp, sizeof(tmp), "%"SWITCH_TIME_T_FMT, caller_profile->times->answered); switch_xml_set_txt_d(time_tag, tmp); if (!(time_tag = switch_xml_add_child_d(x_times, "hangup_time", t_off++))) { goto error; } - snprintf(tmp, sizeof(tmp), "%"APR_TIME_T_FMT, caller_profile->times->hungup); + snprintf(tmp, sizeof(tmp), "%"SWITCH_TIME_T_FMT, caller_profile->times->hungup); switch_xml_set_txt_d(time_tag, tmp); if (!(time_tag = switch_xml_add_child_d(x_times, "transfer_time", t_off++))) { goto error; } - snprintf(tmp, sizeof(tmp), "%"APR_TIME_T_FMT, caller_profile->times->transferred); + snprintf(tmp, sizeof(tmp), "%"SWITCH_TIME_T_FMT, caller_profile->times->transferred); switch_xml_set_txt_d(time_tag, tmp); } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 8db5395c60..e374ac56d2 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -30,7 +30,15 @@ * */ #include -#include + +/* for apr_pstrcat */ +#include + +/* for apr_env_get and apr_env_set */ +#include + +/* for apr file and directory handling */ +#include struct switch_loadable_module { char *filename; @@ -360,11 +368,11 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable static switch_status_t switch_loadable_module_load_file(char *filename, switch_loadable_module_t **new_module) { switch_loadable_module_t *module = NULL; - apr_dso_handle_t *dso = NULL; + switch_dso_handle_t *dso = NULL; apr_status_t status = SWITCH_STATUS_SUCCESS; - apr_dso_handle_sym_t load_function_handle = NULL; - apr_dso_handle_sym_t shutdown_function_handle = NULL; - apr_dso_handle_sym_t runtime_function_handle = NULL; + switch_dso_handle_sym_t load_function_handle = NULL; + switch_dso_handle_sym_t shutdown_function_handle = NULL; + switch_dso_handle_sym_t runtime_function_handle = NULL; switch_module_load_t load_func_ptr = NULL; int loading = 1; const char *err = NULL; @@ -374,16 +382,16 @@ static switch_status_t switch_loadable_module_load_file(char *filename, switch_l assert(filename != NULL); *new_module = NULL; - status = apr_dso_load(&dso, filename, loadable_modules.pool); + status = switch_dso_load(&dso, filename, loadable_modules.pool); while (loading) { if (status != APR_SUCCESS) { - apr_dso_error(dso, derr, sizeof(derr)); + switch_dso_error(dso, derr, sizeof(derr)); err = derr; break; } - status = apr_dso_sym(&load_function_handle, dso, "switch_module_load"); + status = switch_dso_sym(&load_function_handle, dso, "switch_module_load"); load_func_ptr = (switch_module_load_t)(intptr_t) load_function_handle; if (load_func_ptr == NULL) { @@ -414,9 +422,9 @@ static switch_status_t switch_loadable_module_load_file(char *filename, switch_l module->module_interface = module_interface; module->switch_module_load = load_func_ptr; - apr_dso_sym(&shutdown_function_handle, dso, "switch_module_shutdown"); + switch_dso_sym(&shutdown_function_handle, dso, "switch_module_shutdown"); module->switch_module_shutdown = (switch_module_shutdown_t)(intptr_t) shutdown_function_handle; - apr_dso_sym(&runtime_function_handle, dso, "switch_module_runtime"); + switch_dso_sym(&runtime_function_handle, dso, "switch_module_runtime"); module->switch_module_runtime = (switch_module_runtime_t)(intptr_t) runtime_function_handle; module->lib = dso; @@ -700,7 +708,7 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping: %s\n", module->module_interface->module_name); if (module->switch_module_shutdown() == SWITCH_STATUS_UNLOAD) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s unloaded.\n", module->module_interface->module_name); - apr_dso_unload(module->lib); + switch_dso_unload(module->lib); module->lib = NULL; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s shutdown.\n", module->module_interface->module_name); diff --git a/src/switch_log.c b/src/switch_log.c index 8c85274065..44bf2481f8 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -193,12 +193,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char fmt = new_fmt; } -#ifdef HAVE_VASPRINTF - ret = vasprintf(&data, fmt, ap); -#else - data = (char *) malloc(2048); - ret = vsnprintf(data, 2048, fmt, ap); -#endif + ret = switch_vasprintf(&data, fmt, ap); va_end(ap); if (ret == -1) { fprintf(stderr, "Memory Error\n"); diff --git a/src/switch_regex.c b/src/switch_regex.c new file mode 100644 index 0000000000..11492f58a7 --- /dev/null +++ b/src/switch_regex.c @@ -0,0 +1,200 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Michael Jerris + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Michael Jerris + * + * + * switch_regex.c -- PCRE wrapper + * + */ + +#include +#include + + +SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern, + int options, + const char **errorptr, + int *erroroffset, + const unsigned char *tables) +{ + return pcre_compile(pattern, options, errorptr, erroroffset, tables); + +} + +SWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject, + int *ovector, + int stringcount, + int stringnumber, + char *buffer, + int size) +{ + return pcre_copy_substring(subject, ovector, stringcount, stringnumber, buffer, size); +} + +SWITCH_DECLARE(void) switch_regex_free(void *data) +{ + pcre_free(data); +} + +SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen) +{ + const char *error = NULL; + int erroffset = 0; + pcre *re = NULL; + int match_count = 0; + + if (!(field && expression)) { + return 0; + } + + re = pcre_compile(expression, /* the pattern */ + 0, /* default options */ + &error, /* for error message */ + &erroffset, /* for error offset */ + NULL); /* use default character tables */ + if (error) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "COMPILE ERROR: %d [%s]\n", erroffset, error); + switch_regex_safe_free(re); + return 0; + } + + match_count = pcre_exec(re, /* result of pcre_compile() */ + NULL, /* we didn't study the pattern */ + field, /* the subject string */ + (int) strlen(field), /* the length of the subject string */ + 0, /* start at offset 0 in the subject */ + 0, /* default options */ + ovector, /* vector of integers for substring information */ + olen); /* number of elements (NOT size in bytes) */ + + if (match_count <= 0) { + switch_regex_safe_free(re); + match_count = 0; + } + + *new_re = (switch_regex_t *)re; + + return match_count; +} + + +SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector) +{ + char index[10] = ""; + char replace[1024] = ""; + uint32_t x, y = 0, z = 0, num = 0; + + for (x = 0; x < (len-1) && x < strlen(data);) { + if (data[x] == '$') { + x++; + + if (!(data[x] > 47 && data[x] < 58)) { + substituted[y++] = data[x-1]; + continue; + } + + while (data[x] > 47 && data[x] < 58) { + index[z++] = data[x]; + x++; + } + index[z++] = '\0'; + z = 0; + num = atoi(index); + + if (pcre_copy_substring(field_data, + ovector, + match_count, + num, + replace, + sizeof(replace)) > 0) { + unsigned int r; + for (r = 0; r < strlen(replace); r++) { + substituted[y++] = replace[r]; + } + } + } else { + substituted[y++] = data[x]; + x++; + } + } + substituted[y++] = '\0'; +} + +SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expression) { + const char* error = NULL; //Used to hold any errors + int error_offset = 0; //Holds the offset of an error + pcre* pcre_prepared = NULL; //Holds the compiled regex + int match_count = 0; //Number of times the regex was matched + int offset_vectors[2]; //not used, but has to exist or pcre won't even try to find a match + + //Compile the expression + pcre_prepared = pcre_compile(expression, 0, &error, &error_offset, NULL); + + //See if there was an error in the expression + if (error != NULL) { + //Clean up after ourselves + if (pcre_prepared) { + pcre_free(pcre_prepared); + pcre_prepared = NULL; + } + + //Note our error + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Regular Expression Error expression[%s] error[%s] location[%d]\n", expression, error, error_offset); + + //We definitely didn't match anything + return SWITCH_STATUS_FALSE; + } + + //So far so good, run the regex + match_count = pcre_exec(pcre_prepared, NULL, target, (int) strlen(target), 0, 0, offset_vectors, sizeof(offset_vectors) / sizeof(offset_vectors[0])); + + //Clean up + if (pcre_prepared) { + pcre_free(pcre_prepared); + pcre_prepared = NULL; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number of matches: %d\n", match_count); + + //Was it a match made in heaven? + if (match_count > 0) { + return SWITCH_STATUS_SUCCESS; + } else { + return SWITCH_STATUS_FALSE; + } +} + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/switch_rtp.c b/src/switch_rtp.c index b7d534e136..bed0dbd857 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -242,7 +242,7 @@ static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len) remote_ip = switch_get_addr(ipbuf, sizeof(ipbuf), rtp_session->from_addr); - switch_stun_packet_attribute_add_binded_address(rpacket, remote_ip, rtp_session->from_addr->port); + switch_stun_packet_attribute_add_binded_address(rpacket, remote_ip, switch_sockaddr_get_port(rtp_session->from_addr)); bytes = switch_stun_packet_length(rpacket); switch_socket_sendto(rtp_session->sock, rtp_session->from_addr, 0, (void*)rpacket, &bytes); } @@ -310,7 +310,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s new_sock = NULL; if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) { - switch_socket_opt_set(rtp_session->sock, APR_SO_NONBLOCK, TRUE); + switch_socket_opt_set(rtp_session->sock, SWITCH_SO_NONBLOCK, TRUE); switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK); } @@ -566,7 +566,7 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session) switch_mutex_lock(rtp_session->flag_mutex); if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) { assert(rtp_session->sock != NULL); - apr_socket_shutdown(rtp_session->sock, APR_SHUTDOWN_READWRITE); + switch_socket_shutdown(rtp_session->sock, SWITCH_SHUTDOWN_READWRITE); switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO); } switch_mutex_unlock(rtp_session->flag_mutex); @@ -869,21 +869,21 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (rtp_session->recv_msg.header.version) { - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) { char *tx_host; char *old_host; char bufa[30], bufb[30]; tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr); old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr); - if ((rtp_session->from_addr->port != rtp_session->remote_port) || strcmp(tx_host, old_host)) { + if ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) { const char *err; uint32_t old = rtp_session->remote_port; - if (!switch_strlen_zero(tx_host) && rtp_session->from_addr->port > 0) { + if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n", - old_host, old, tx_host, rtp_session->from_addr->port); - switch_rtp_set_remote_address(rtp_session, tx_host, rtp_session->from_addr->port, &err); + old_host, old, tx_host, switch_sockaddr_get_port(rtp_session->from_addr)); + switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), &err); } } switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); diff --git a/src/switch_stun.c b/src/switch_stun.c index 9e41e06d3a..d150cf9971 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -100,7 +100,7 @@ SWITCH_DECLARE(void) switch_stun_random_string(char *buf, uint16_t len, char *se max = (int)strlen(set); - srand((unsigned int)apr_time_now()); + srand((unsigned int)switch_time_now()); for(x = 0; x < len; x++) { int j = (int)(max*1.0*rand()/(RAND_MAX+1.0)); @@ -313,7 +313,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup (char **ip, return SWITCH_STATUS_FALSE; } - switch_socket_opt_set(sock, APR_SO_NONBLOCK, TRUE); + switch_socket_opt_set(sock, SWITCH_SO_NONBLOCK, TRUE); packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, buf); switch_stun_random_string(username, 32, NULL); switch_stun_packet_attribute_add_username(packet, username, 32); @@ -333,7 +333,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup (char **ip, if ((elapsed = (unsigned int)((switch_time_now() - started) / 1000)) > 5000) { *err = "Timeout"; - switch_socket_shutdown(sock, APR_SHUTDOWN_READWRITE); + switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE); switch_socket_close(sock); return SWITCH_STATUS_TIMEOUT; } diff --git a/src/switch_utils.c b/src/switch_utils.c index 72dc1d31de..8b1e3a243c 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -30,9 +30,6 @@ * */ #include -#include -#include -#include #ifndef WIN32 #include #endif @@ -193,97 +190,12 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int fam } -SWITCH_DECLARE(int) switch_perform_regex(char *field, char *expression, pcre **new_re, int *ovector, uint32_t olen) -{ - const char *error = NULL; - int erroffset = 0; - pcre *re = NULL; - int match_count = 0; - - if (!(field && expression)) { - return 0; - } - - re = pcre_compile(expression, /* the pattern */ - 0, /* default options */ - &error, /* for error message */ - &erroffset, /* for error offset */ - NULL); /* use default character tables */ - if (error) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "COMPILE ERROR: %d [%s]\n", erroffset, error); - switch_clean_re(re); - return 0; - } - - match_count = pcre_exec(re, /* result of pcre_compile() */ - NULL, /* we didn't study the pattern */ - field, /* the subject string */ - (int) strlen(field), /* the length of the subject string */ - 0, /* start at offset 0 in the subject */ - 0, /* default options */ - ovector, /* vector of integers for substring information */ - olen); /* number of elements (NOT size in bytes) */ - - if (match_count <= 0) { - switch_clean_re(re); - match_count = 0; - } - - *new_re = re; - - return match_count; -} - - -SWITCH_DECLARE(void) switch_perform_substitution(pcre *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector) -{ - char index[10] = ""; - char replace[1024] = ""; - uint32_t x, y = 0, z = 0, num = 0; - - for (x = 0; x < (len-1) && x < strlen(data);) { - if (data[x] == '$') { - x++; - - if (!(data[x] > 47 && data[x] < 58)) { - substituted[y++] = data[x-1]; - continue; - } - - while (data[x] > 47 && data[x] < 58) { - index[z++] = data[x]; - x++; - } - index[z++] = '\0'; - z = 0; - num = atoi(index); - - if (pcre_copy_substring(field_data, - ovector, - match_count, - num, - replace, - sizeof(replace)) > 0) { - unsigned int r; - for (r = 0; r < strlen(replace); r++) { - substituted[y++] = replace[r]; - } - } - } else { - substituted[y++] = data[x]; - x++; - } - } - substituted[y++] = '\0'; -} - - SWITCH_DECLARE(switch_time_t) switch_str_time(char *in) { switch_time_exp_t tm = {0}; int proceed = 0, ovector[30]; - pcre *re = NULL; + switch_regex_t *re = NULL; char replace[1024] = ""; switch_time_t ret = 0; char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)"; @@ -291,39 +203,39 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(char *in) switch_time_exp_lt(&tm, switch_time_now()); tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0; - if ((proceed = switch_perform_regex(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if ((proceed = switch_regex_perform(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { if (proceed > 1) { - pcre_copy_substring(in, ovector, proceed, 1, replace, sizeof(replace)); + switch_regex_copy_substring(in, ovector, proceed, 1, replace, sizeof(replace)); tm.tm_year = atoi(replace) - 1900; } if (proceed > 2) { - pcre_copy_substring(in, ovector, proceed, 2, replace, sizeof(replace)); + switch_regex_copy_substring(in, ovector, proceed, 2, replace, sizeof(replace)); tm.tm_mon = atoi(replace) - 1; } if (proceed > 3) { - pcre_copy_substring(in, ovector, proceed, 3, replace, sizeof(replace)); + switch_regex_copy_substring(in, ovector, proceed, 3, replace, sizeof(replace)); tm.tm_mday = atoi(replace); } if (proceed > 4) { - pcre_copy_substring(in, ovector, proceed, 4, replace, sizeof(replace)); + switch_regex_copy_substring(in, ovector, proceed, 4, replace, sizeof(replace)); tm.tm_hour = atoi(replace); } if (proceed > 5) { - pcre_copy_substring(in, ovector, proceed, 5, replace, sizeof(replace)); + switch_regex_copy_substring(in, ovector, proceed, 5, replace, sizeof(replace)); tm.tm_min = atoi(replace); } if (proceed > 6) { - pcre_copy_substring(in, ovector, proceed, 6, replace, sizeof(replace)); + switch_regex_copy_substring(in, ovector, proceed, 6, replace, sizeof(replace)); tm.tm_sec = atoi(replace); } - apr_time_exp_gmt_get(&ret, &tm); + switch_time_exp_gmt_get(&ret, &tm); return ret; } /* possible else with more patterns later */ @@ -331,20 +243,6 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(char *in) } -SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename) -{ - int32_t wanted = APR_FINFO_TYPE; - apr_finfo_t info = {0}; - if (filename) { - apr_stat(&info, filename, wanted, NULL); - if (info.filetype != APR_NOFILE) { - return SWITCH_STATUS_SUCCESS; - } - } - return SWITCH_STATUS_FALSE; -} - - SWITCH_DECLARE(char *) switch_priority_name(switch_priority_t priority) { switch(priority) { /*lol*/ @@ -377,28 +275,6 @@ SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in return buf; } -SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in) -{ - return get_addr(buf, len, &in->sa.sin.sin_addr); -} - -SWITCH_DECLARE(apr_status_t) switch_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) -{ - apr_status_t r; - - if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) { - from->port = ntohs(from->sa.sin.sin_port); - /* from->ipaddr_ptr = &(from->sa.sin.sin_addr); - * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr); - */ - } - - return r; - -} - SWITCH_DECLARE(char) switch_rfc2833_to_char(int event) { if (event > -1 && event < (int32_t) sizeof(RFC2833_CHARS)) { @@ -530,26 +406,6 @@ SWITCH_DECLARE(const char *) switch_cut_path(const char *in) } } -SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, - switch_int16_t flags, switch_memory_pool_t *pool) -{ - switch_pollset_t *pollset; - - if (switch_pollset_create(&pollset, 1, pool, flags) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_GENERR; - } - - poll->desc_type = SWITCH_POLL_SOCKET; - poll->reqevents = flags; - poll->desc.s = sock; - poll->client_data = sock; - - if (switch_pollset_add(pollset, poll) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_GENERR; - } - - return SWITCH_STATUS_SUCCESS; -} SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len) { @@ -661,17 +517,6 @@ SWITCH_DECLARE(char *) switch_url_decode(char *s) } -#ifdef WIN32 -/* this forces certain symbols to not be optimized out of the dll */ -void include_me(void) -{ - apr_socket_shutdown(NULL, 0); - apr_socket_recvfrom(NULL, NULL, 0, NULL, NULL); - apr_mcast_join(NULL, NULL, NULL, NULL); - apr_socket_opt_set(NULL, 0, 0); -} -#endif - /* For Emacs: * Local Variables: * mode:c diff --git a/src/switch_xml.c b/src/switch_xml.c index 7139c5d03e..4641c09e36 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -54,8 +54,10 @@ */ #include -#include -#include +#ifndef WIN32 +#include +#endif + #ifdef HAVE_MMAP #include #endif diff --git a/w32/Library/FreeSwitchCore.vcproj b/w32/Library/FreeSwitchCore.vcproj index c5ee8115f1..7ed692f7e2 100644 --- a/w32/Library/FreeSwitchCore.vcproj +++ b/w32/Library/FreeSwitchCore.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libresample\include;..\..\libs\libteletone\src" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -137,7 +137,7 @@ + + @@ -247,6 +251,10 @@ RelativePath="..\..\src\switch_core.c" > + + @@ -263,6 +271,10 @@ RelativePath="..\..\src\switch_log.c" > + + @@ -321,6 +333,10 @@ RelativePath="..\..\src\include\switch_core.h" > + + @@ -349,6 +365,10 @@ RelativePath="..\..\src\include\switch_platform.h" > + + @@ -357,10 +377,6 @@ RelativePath="..\..\src\include\switch_rtp.h" > - -