diff options
Diffstat (limited to 'pjsip-apps')
-rw-r--r-- | pjsip-apps/build/Samples-vc.mak | 1 | ||||
-rw-r--r-- | pjsip-apps/build/Samples.mak | 1 | ||||
-rw-r--r-- | pjsip-apps/build/samples.dsp | 4 | ||||
-rw-r--r-- | pjsip-apps/build/samples.vcproj | 354 | ||||
-rw-r--r-- | pjsip-apps/src/samples/httpdemo.c | 151 |
5 files changed, 336 insertions, 175 deletions
diff --git a/pjsip-apps/build/Samples-vc.mak b/pjsip-apps/build/Samples-vc.mak index 89b9204d..3b03cf72 100644 --- a/pjsip-apps/build/Samples-vc.mak +++ b/pjsip-apps/build/Samples-vc.mak @@ -62,6 +62,7 @@ SAMPLES = $(BINDIR)\auddemo.exe \ $(BINDIR)\confsample.exe \ $(BINDIR)\confbench.exe \ $(BINDIR)\encdec.exe \ + $(BINDIR)\httpdemo.exe \ $(BINDIR)\icedemo.exe \ $(BINDIR)\jbsim.exe \ $(BINDIR)\latency.exe \ diff --git a/pjsip-apps/build/Samples.mak b/pjsip-apps/build/Samples.mak index 18b13bca..0247b888 100644 --- a/pjsip-apps/build/Samples.mak +++ b/pjsip-apps/build/Samples.mak @@ -16,6 +16,7 @@ BINDIR := ../bin/samples/$(TARGET_NAME) SAMPLES := auddemo \ confsample \ encdec \ + httpdemo \ icedemo \ jbsim \ latency \ diff --git a/pjsip-apps/build/samples.dsp b/pjsip-apps/build/samples.dsp index 758e6b6f..dd950370 100644 --- a/pjsip-apps/build/samples.dsp +++ b/pjsip-apps/build/samples.dsp @@ -110,6 +110,10 @@ SOURCE=..\src\samples\footprint.c # End Source File
# Begin Source File
+SOURCE=..\src\samples\httpdemo.c
+# End Source File
+# Begin Source File
+
SOURCE=..\src\samples\icedemo.c
# End Source File
# Begin Source File
diff --git a/pjsip-apps/build/samples.vcproj b/pjsip-apps/build/samples.vcproj index ba73d151..09767799 100644 --- a/pjsip-apps/build/samples.vcproj +++ b/pjsip-apps/build/samples.vcproj @@ -12,16 +12,16 @@ Name="Win32"
/>
<Platform
- Name="Windows Mobile 6 Standard SDK (ARMV4I)"
+ Name="Pocket PC 2003 (ARMV4)"
/>
<Platform
- Name="Windows Mobile 6 Professional SDK (ARMV4I)"
+ Name="Smartphone 2003 (ARMV4)"
/>
<Platform
- Name="Pocket PC 2003 (ARMV4)"
+ Name="Windows Mobile 6 Standard SDK (ARMV4I)"
/>
<Platform
- Name="Smartphone 2003 (ARMV4)"
+ Name="Windows Mobile 6 Professional SDK (ARMV4I)"
/>
<Platform
Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
@@ -58,8 +58,8 @@ />
</Configuration>
<Configuration
- Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release|Pocket PC 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -97,8 +97,8 @@ />
</Configuration>
<Configuration
- Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release|Smartphone 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -136,8 +136,8 @@ />
</Configuration>
<Configuration
- Name="Release|Pocket PC 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug|Win32"
+ OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -147,9 +147,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -158,25 +158,10 @@ ForcedUsingAssemblies=""
CompileAsManaged=""
/>
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
</Configuration>
<Configuration
- Name="Release|Smartphone 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug|Pocket PC 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -186,9 +171,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -214,32 +199,8 @@ />
</Configuration>
<Configuration
- Name="Debug|Win32"
- OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
- IntermediateDirectory="$(OutDir)"
- ConfigurationType="0"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- BuildLogFile=""
- >
- <Tool
- Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
- Output="All samples"
- PreprocessorDefinitions=""
- IncludeSearchPath=""
- ForcedIncludes=""
- AssemblySearchPath=""
- ForcedUsingAssemblies=""
- CompileAsManaged=""
- />
- </Configuration>
- <Configuration
- Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug|Smartphone 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -277,8 +238,8 @@ />
</Configuration>
<Configuration
- Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug-Static|Win32"
+ OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -288,9 +249,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -299,24 +260,9 @@ ForcedUsingAssemblies=""
CompileAsManaged=""
/>
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
</Configuration>
<Configuration
- Name="Debug|Pocket PC 2003 (ARMV4)"
+ Name="Debug-Static|Pocket PC 2003 (ARMV4)"
OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -327,9 +273,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -355,7 +301,7 @@ />
</Configuration>
<Configuration
- Name="Debug|Smartphone 2003 (ARMV4)"
+ Name="Debug-Static|Smartphone 2003 (ARMV4)"
OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -366,9 +312,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -394,7 +340,7 @@ />
</Configuration>
<Configuration
- Name="Debug-Static|Win32"
+ Name="Release-Dynamic|Win32"
OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -405,9 +351,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -418,8 +364,8 @@ />
</Configuration>
<Configuration
- Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Dynamic|Pocket PC 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -429,9 +375,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -457,8 +403,8 @@ />
</Configuration>
<Configuration
- Name="Debug-Static|Windows Mobile 6 Professional SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Dynamic|Smartphone 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -468,9 +414,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -496,7 +442,31 @@ />
</Configuration>
<Configuration
- Name="Debug-Static|Pocket PC 2003 (ARMV4)"
+ Name="Debug-Dynamic|Win32"
+ OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="0"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ BuildLogFile=""
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+ Output="All samples"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug-Dynamic|Pocket PC 2003 (ARMV4)"
OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -507,9 +477,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -535,7 +505,7 @@ />
</Configuration>
<Configuration
- Name="Debug-Static|Smartphone 2003 (ARMV4)"
+ Name="Debug-Dynamic|Smartphone 2003 (ARMV4)"
OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -546,9 +516,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -574,7 +544,7 @@ />
</Configuration>
<Configuration
- Name="Release-Dynamic|Win32"
+ Name="Release-Static|Win32"
OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -585,9 +555,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -598,8 +568,8 @@ />
</Configuration>
<Configuration
- Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Static|Pocket PC 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -609,9 +579,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -637,8 +607,8 @@ />
</Configuration>
<Configuration
- Name="Release-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Static|Smartphone 2003 (ARMV4)"
+ OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -648,9 +618,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -676,8 +646,8 @@ />
</Configuration>
<Configuration
- Name="Release-Dynamic|Pocket PC 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -687,9 +657,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -715,8 +685,8 @@ />
</Configuration>
<Configuration
- Name="Release-Dynamic|Smartphone 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -726,9 +696,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -754,8 +724,8 @@ />
</Configuration>
<Configuration
- Name="Debug-Dynamic|Win32"
- OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -765,9 +735,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -776,10 +746,25 @@ ForcedUsingAssemblies=""
CompileAsManaged=""
/>
+ <Tool
+ Name="VCCLCompilerTool"
+ ExecutionBucket="7"
+ />
+ <Tool
+ Name="VCCodeSignTool"
+ />
+ <DeploymentTool
+ ForceDirty="-1"
+ RemoteDirectory=""
+ RegisterOutput="0"
+ AdditionalFiles=""
+ />
+ <DebuggerTool
+ />
</Configuration>
<Configuration
- Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -789,9 +774,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -817,8 +802,8 @@ />
</Configuration>
<Configuration
- Name="Debug-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
- OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -828,9 +813,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -856,8 +841,8 @@ />
</Configuration>
<Configuration
- Name="Debug-Dynamic|Pocket PC 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Debug-Static|Windows Mobile 6 Professional SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -867,9 +852,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -895,8 +880,8 @@ />
</Configuration>
<Configuration
- Name="Debug-Dynamic|Smartphone 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -906,9 +891,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -934,8 +919,8 @@ />
</Configuration>
<Configuration
- Name="Release-Static|Win32"
- OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -945,9 +930,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -956,9 +941,24 @@ ForcedUsingAssemblies=""
CompileAsManaged=""
/>
+ <Tool
+ Name="VCCLCompilerTool"
+ ExecutionBucket="7"
+ />
+ <Tool
+ Name="VCCodeSignTool"
+ />
+ <DeploymentTool
+ ForceDirty="-1"
+ RemoteDirectory=""
+ RegisterOutput="0"
+ AdditionalFiles=""
+ />
+ <DebuggerTool
+ />
</Configuration>
<Configuration
- Name="Release-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
+ Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -969,9 +969,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -997,7 +997,7 @@ />
</Configuration>
<Configuration
- Name="Release-Static|Windows Mobile 6 Professional SDK (ARMV4I)"
+ Name="Debug-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
@@ -1008,9 +1008,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8"
- ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
- CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
+ BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+ ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+ CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
Output="All samples"
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -1036,8 +1036,8 @@ />
</Configuration>
<Configuration
- Name="Release-Static|Pocket PC 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -1075,8 +1075,8 @@ />
</Configuration>
<Configuration
- Name="Release-Static|Smartphone 2003 (ARMV4)"
- OutputDirectory=".\output\$(ProjectName)-wm2003sp-$(PlatformName)-vs8-$(ConfigurationName)"
+ Name="Release-Static|Windows Mobile 6 Professional SDK (ARMV4I)"
+ OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@@ -1614,6 +1614,10 @@ >
</File>
<File
+ RelativePath="..\src\samples\httpdemo.c"
+ >
+ </File>
+ <File
RelativePath="..\src\samples\icedemo.c"
>
</File>
diff --git a/pjsip-apps/src/samples/httpdemo.c b/pjsip-apps/src/samples/httpdemo.c new file mode 100644 index 00000000..9dc3c0eb --- /dev/null +++ b/pjsip-apps/src/samples/httpdemo.c @@ -0,0 +1,151 @@ +/* $Id$ */ +/* + * Copyright (C) 2008-2010 Teluu Inc. (http://www.teluu.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * \page page_httpdemo_c Samples: HTTP Client demo + * + * This file is pjsip-apps/src/samples/httpdemo.c + * + * \includelineno httpdemo.c + */ + +#include <pjlib.h> +#include <pjlib-util.h> +#include <pjlib-util/http_client.h> +#include <pjsip.h> +#include <pjmedia.h> +#include <pjnath.h> +#include <pjsip_simple.h> + +static pj_timer_heap_t *timer_heap; +static pj_ioqueue_t *ioqueue; +static pj_pool_t *pool; +static pj_http_req *http_req; +static pj_pool_factory *mem; +static FILE *f = NULL; + +//#define VERBOSE +#define THIS_FILE "http_demo" + +static void on_data_read(pj_http_req *hreq, void *data, pj_size_t size) +{ + PJ_UNUSED_ARG(hreq); + + if (size > 0) { + fwrite(data, 1, size, f); + fflush(f); +#ifdef VERBOSE + PJ_LOG(3, (THIS_FILE, "\nData received: %d bytes\n", size)); + printf("%.*s\n", (int)size, (char *)data); +#endif + } +} + +static void on_complete(pj_http_req *hreq, pj_status_t status, + const pj_http_resp *resp) +{ + PJ_UNUSED_ARG(hreq); + + if (status == PJ_ECANCELLED) { + PJ_LOG(3, (THIS_FILE, "Request cancelled\n")); + return; + } else if (status == PJ_ETIMEDOUT) { + PJ_LOG(3, (THIS_FILE, "Request timed out!\n")); + return; + } else if (status != PJ_SUCCESS && status != PJ_EPENDING) { + PJ_LOG(3, (THIS_FILE, "Error %d\n", status)); + return; + } + PJ_LOG(3, (THIS_FILE, "\nData completed: %d bytes\n", resp->size)); + if (resp->size > 0 && resp->data) { +#ifdef VERBOSE + printf("%.*s\n", (int)resp->size, (char *)resp->data); +#endif + } +} + +pj_status_t getURL(const char *curl) +{ + pj_str_t url; + pj_http_req_callback hcb; + pj_status_t status; + + pj_bzero(&hcb, sizeof(hcb)); + hcb.on_complete = &on_complete; + hcb.on_data_read = &on_data_read; + + /* Create pool, timer, and ioqueue */ + pool = pj_pool_create(mem, NULL, 8192, 4096, NULL); + if (pj_timer_heap_create(pool, 16, &timer_heap)) + return -31; + if (pj_ioqueue_create(pool, 16, &ioqueue)) + return -32; + + pj_strdup2(pool, &url, curl); + + if ((status = pj_http_req_create(pool, &url, timer_heap, ioqueue, + NULL, &hcb, &http_req)) != PJ_SUCCESS) + return status; + + if ((status = pj_http_req_start(http_req)) != PJ_SUCCESS) + return status; + + while (pj_http_req_is_running(http_req)) { + pj_time_val delay = {0, 50}; + pj_ioqueue_poll(ioqueue, &delay); + pj_timer_heap_poll(timer_heap, NULL); + } + + pj_http_req_destroy(http_req); + pj_ioqueue_destroy(ioqueue); + pj_timer_heap_destroy(timer_heap); + pj_pool_release(pool); + + return PJ_SUCCESS; +} +/* + * main() + */ +int main(int argc, char *argv[]) +{ + pj_caching_pool cp; + pj_status_t status; + + if (argc != 3) { + puts("Usage: httpdemo URL filename"); + return 1; + } + + pj_log_set_level(3); + + pj_init(); + pj_caching_pool_init(&cp, NULL, 0); + mem = &cp.factory; + pjlib_util_init(); + + f = fopen(argv[2], "wb"); + status = getURL(argv[1]); + if (status != PJ_SUCCESS) { + PJ_PERROR(1, (THIS_FILE, status, "Error")); + } + fclose(f); + + pj_shutdown(); + return 0; +} |