Compare commits
	
		
			14 Commits
		
	
	
		
			a05bbf5fd6
			...
			v0.0.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 057a23d435 | |||
| fb4a3a9d82 | |||
| 495eda6abe | |||
| 906dd79c64 | |||
| 241e18a832 | |||
| 5c6779b80b | |||
| 284d15e58d | |||
| 5da6c02b2d | |||
| ee8d8c31d5 | |||
| 8ec8df566a | |||
| 809d6d1d2f | |||
| 12ad56ea95 | |||
| e169ff8c70 | |||
| ba126051c5 | 
							
								
								
									
										10
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								INSTALL
									
									
									
									
									
								
							| @ -1,14 +1,16 @@ | |||||||
| pre-requisites to build actube | pre-requisites to build actube | ||||||
| ============================== | ============================== | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| On FreeBSD 10.2 | On FreeBSD 10.2 | ||||||
| ---------------- | ---------------- | ||||||
|  |  | ||||||
| pkg install gmake |  | ||||||
| pkg install gnutls |  | ||||||
| pkg install libconfuse | pkg install libconfuse | ||||||
| pkg install sqlite3 | pkg install wget | ||||||
| pkg install p11-kit | pkg install libnettle | ||||||
|  |  | ||||||
|  |  | ||||||
| Ubuntu 14.04 | Ubuntu 14.04 | ||||||
|  | |||||||
							
								
								
									
										17
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,28 +1,11 @@ | |||||||
| TARGETS=\ |  | ||||||
| 	src/contrib/jsmn \ |  | ||||||
| 	src/cw |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #src/cw src/mod src/ac  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| all: | all: | ||||||
|  |  | ||||||
| #$(foreach i,$(TARGETS),$(call $(MAKE) -c, $i)) |  | ||||||
|  |  | ||||||
| 	$(MAKE) -C src/contrib/jsmn |  | ||||||
| 	$(MAKE) -C src/cw | 	$(MAKE) -C src/cw | ||||||
| 	$(MAKE) -C src/mod | 	$(MAKE) -C src/mod | ||||||
| 	$(MAKE) -C src/ac | 	$(MAKE) -C src/ac | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
|  |  | ||||||
| #$(foreach i,$(TARGETS),$(call $(MAKE) -c, $i)) |  | ||||||
|  |  | ||||||
| 	$(MAKE) -C src/contrib/jsmn clean |  | ||||||
| 	$(MAKE) -C src/cw clean | 	$(MAKE) -C src/cw clean | ||||||
| 	$(MAKE) -C src/mod clean | 	$(MAKE) -C src/mod clean | ||||||
| 	$(MAKE) -C src/ac clean | 	$(MAKE) -C src/ac clean | ||||||
|  | |||||||
| @ -1,121 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <CodeLite_Project Name="mod_capwap" InternalType=""> |  | ||||||
|   <VirtualDirectory Name="src"> |  | ||||||
|     <VirtualDirectory Name="mod"> |  | ||||||
|       <VirtualDirectory Name="capwap"> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_ac_ip_list.c"/> |  | ||||||
|         <File Name="src/mod/capwap/mod_capwap_ac.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_wtp_board_data.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_actions_wtp.c"/> |  | ||||||
|         <File Name="src/mod/capwap/mod_capwap_wtp.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_ac_descriptor.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_ac_ip_list.c"/> |  | ||||||
|         <File Name="src/mod/capwap/mod_capwap.h"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_wtp_descriptor.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_session_id.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_get_session_id.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_get_idle_timeout.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_actions_ac.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_vendor_specific_payload.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_mtu_discovery_padding.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_wtp_board_data.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_wtp_descriptor.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_capwap_control_ip_address.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_capwap_control_ip_address.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_in_ac_descriptor.c"/> |  | ||||||
|         <File Name="src/mod/capwap/capwap_out_capwap_local_ip_address.c"/> |  | ||||||
|       </VirtualDirectory> |  | ||||||
|     </VirtualDirectory> |  | ||||||
|   </VirtualDirectory> |  | ||||||
|   <Description/> |  | ||||||
|   <Dependencies/> |  | ||||||
|   <Settings Type="Dynamic Library"> |  | ||||||
|     <GlobalSettings> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler=""> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options=""> |  | ||||||
|         <LibraryPath Value="."/> |  | ||||||
|       </Linker> |  | ||||||
|       <ResourceCompiler Options=""/> |  | ||||||
|     </GlobalSettings> |  | ||||||
|     <Configuration Name="Debug" CompilerType="clang( tags/RELEASE_380/final )" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand>make clean && make</RebuildCommand> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)/src/mod/capwap/</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|     <Configuration Name="Release" CompilerType="clang( tags/RELEASE_380/final )" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="-O2" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand/> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|   </Settings> |  | ||||||
|   <Dependencies Name="Debug"/> |  | ||||||
|   <Dependencies Name="Release"/> |  | ||||||
| </CodeLite_Project> |  | ||||||
| @ -1,105 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <CodeLite_Project Name="mod_capwap80211" InternalType=""> |  | ||||||
|   <VirtualDirectory Name="src"> |  | ||||||
|     <VirtualDirectory Name="mod"> |  | ||||||
|       <VirtualDirectory Name="capwap80211"> |  | ||||||
|         <File Name="src/mod/capwap80211/mod_capwap80211.h"/> |  | ||||||
|         <File Name="src/mod/capwap80211/capwap80211_out_wtp_radio_cfg.c"/> |  | ||||||
|         <File Name="src/mod/capwap80211/mod_capwap80211.c"/> |  | ||||||
|         <File Name="src/mod/capwap80211/capwap80211_messages.c"/> |  | ||||||
|       </VirtualDirectory> |  | ||||||
|     </VirtualDirectory> |  | ||||||
|   </VirtualDirectory> |  | ||||||
|   <Description/> |  | ||||||
|   <Dependencies/> |  | ||||||
|   <Settings Type="Dynamic Library"> |  | ||||||
|     <GlobalSettings> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler=""> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options=""> |  | ||||||
|         <LibraryPath Value="."/> |  | ||||||
|       </Linker> |  | ||||||
|       <ResourceCompiler Options=""/> |  | ||||||
|     </GlobalSettings> |  | ||||||
|     <Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand>make clean && make |  | ||||||
| </RebuildCommand> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)/src/mod/capwap80211/</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|     <Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="-O2" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand/> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|   </Settings> |  | ||||||
|   <Dependencies Name="Debug"/> |  | ||||||
|   <Dependencies Name="Release"/> |  | ||||||
| </CodeLite_Project> |  | ||||||
| @ -1,105 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <CodeLite_Project Name="mod_cipwap" InternalType=""> |  | ||||||
|   <VirtualDirectory Name="src"> |  | ||||||
|     <VirtualDirectory Name="mod"> |  | ||||||
|       <VirtualDirectory Name="cipwap"> |  | ||||||
|         <File Name="src/mod/cipwap/cipwap_actions_ac.c"/> |  | ||||||
|         <File Name="src/mod/cipwap/mod_cipwap_ac.c"/> |  | ||||||
|         <File Name="src/mod/cipwap/mod_cipwap.h"/> |  | ||||||
|         <File Name="src/mod/cipwap/mod_cipwap_wtp.c"/> |  | ||||||
|         <File Name="src/mod/cipwap/cipwap_actions_wtp.c"/> |  | ||||||
|       </VirtualDirectory> |  | ||||||
|     </VirtualDirectory> |  | ||||||
|   </VirtualDirectory> |  | ||||||
|   <Description/> |  | ||||||
|   <Dependencies/> |  | ||||||
|   <Settings Type="Dynamic Library"> |  | ||||||
|     <GlobalSettings> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler=""> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options=""> |  | ||||||
|         <LibraryPath Value="."/> |  | ||||||
|       </Linker> |  | ||||||
|       <ResourceCompiler Options=""/> |  | ||||||
|     </GlobalSettings> |  | ||||||
|     <Configuration Name="Debug" CompilerType="clang( tags/RELEASE_380/final )" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand>make clean && make</RebuildCommand> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)/src/mod/cipwap</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|     <Configuration Name="Release" CompilerType="clang( tags/RELEASE_380/final )" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="-O2" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand/> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|   </Settings> |  | ||||||
|   <Dependencies Name="Debug"/> |  | ||||||
|   <Dependencies Name="Release"/> |  | ||||||
| </CodeLite_Project> |  | ||||||
| @ -1,104 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <CodeLite_Project Name="mod_fortinet" InternalType=""> |  | ||||||
|   <VirtualDirectory Name="src"> |  | ||||||
|     <VirtualDirectory Name="mod"> |  | ||||||
|       <VirtualDirectory Name="fortinet"> |  | ||||||
|         <File Name="src/mod/fortinet/mod_fortinet_ac.c"/> |  | ||||||
|         <File Name="src/mod/fortinet/mod_fortinet_wtp.c"/> |  | ||||||
|         <File Name="src/mod/fortinet/fortinet.h"/> |  | ||||||
|         <File Name="src/mod/fortinet/fortinet_actions_ac.c"/> |  | ||||||
|         <File Name="src/mod/fortinet/fortinet_actions_wtp.c"/> |  | ||||||
|         <File Name="src/mod/fortinet/mod_fortinet.h"/> |  | ||||||
|       </VirtualDirectory> |  | ||||||
|     </VirtualDirectory> |  | ||||||
|   </VirtualDirectory> |  | ||||||
|   <Description/> |  | ||||||
|   <Dependencies/> |  | ||||||
|   <Settings Type="Dynamic Library"> |  | ||||||
|     <GlobalSettings> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler=""> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options=""> |  | ||||||
|         <LibraryPath Value="."/> |  | ||||||
|       </Linker> |  | ||||||
|       <ResourceCompiler Options=""/> |  | ||||||
|     </GlobalSettings> |  | ||||||
|     <Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand>make clean && make</RebuildCommand> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)/src/mod/fortinet</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|     <Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> |  | ||||||
|       <Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> |  | ||||||
|         <IncludePath Value="."/> |  | ||||||
|       </Compiler> |  | ||||||
|       <Linker Options="-O2" Required="yes"/> |  | ||||||
|       <ResourceCompiler Options="" Required="no"/> |  | ||||||
|       <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> |  | ||||||
|       <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> |  | ||||||
|         <![CDATA[]]> |  | ||||||
|       </Environment> |  | ||||||
|       <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> |  | ||||||
|         <DebuggerSearchPaths/> |  | ||||||
|         <PostConnectCommands/> |  | ||||||
|         <StartupCommands/> |  | ||||||
|       </Debugger> |  | ||||||
|       <PreBuild/> |  | ||||||
|       <PostBuild/> |  | ||||||
|       <CustomBuild Enabled="yes"> |  | ||||||
|         <RebuildCommand/> |  | ||||||
|         <CleanCommand>make clean</CleanCommand> |  | ||||||
|         <BuildCommand>make</BuildCommand> |  | ||||||
|         <PreprocessFileCommand/> |  | ||||||
|         <SingleFileCommand/> |  | ||||||
|         <MakefileGenerationCommand/> |  | ||||||
|         <ThirdPartyToolName>None</ThirdPartyToolName> |  | ||||||
|         <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> |  | ||||||
|       </CustomBuild> |  | ||||||
|       <AdditionalRules> |  | ||||||
|         <CustomPostBuild/> |  | ||||||
|         <CustomPreBuild/> |  | ||||||
|       </AdditionalRules> |  | ||||||
|       <Completion EnableCpp11="no" EnableCpp14="no"> |  | ||||||
|         <ClangCmpFlagsC/> |  | ||||||
|         <ClangCmpFlags/> |  | ||||||
|         <ClangPP/> |  | ||||||
|         <SearchPaths/> |  | ||||||
|       </Completion> |  | ||||||
|     </Configuration> |  | ||||||
|   </Settings> |  | ||||||
| </CodeLite_Project> |  | ||||||
| @ -7,24 +7,21 @@ OBJS = \ | |||||||
| 	dataman.o \ | 	dataman.o \ | ||||||
| 	ac_interface.o \ | 	ac_interface.o \ | ||||||
| 	socklist.o \ | 	socklist.o \ | ||||||
| 	db.o \ |  | ||||||
| 	ac_global.o \ |  | ||||||
| 	discovery_cache.o\ | 	discovery_cache.o\ | ||||||
| 	shell.o\ | 	shell.o\ | ||||||
|  |  | ||||||
| PRG=actube | PRG=actube | ||||||
| LIBPATH=-L../../lib/Linux/$(ARCH)/ -L/usr/local/lib -L/usr/lib  | LIBPATH=-L../../lib/$(KERNEL)/$(ARCH)/ -L/usr/local/lib -L/usr/lib  | ||||||
|  |  | ||||||
| LIBS+=-lmavl | LIBS+=-lmavl | ||||||
| LIBS+=-lcw | LIBS+=-lcw | ||||||
| LIBS+=-lrt | LIBS+=-lrt | ||||||
| LIBS+=-lpthread | LIBS+=-lpthread | ||||||
| LIBS+=-lconfuse | LIBS+=-lconfuse | ||||||
| LIBS+=-lsqlite3 |  | ||||||
| LIBS+=-lc | LIBS+=-lc | ||||||
| LIBS+=-lnettle | LIBS+=-lnettle | ||||||
| LIBS+=-lssl | LIBS+=-lssl | ||||||
| LIBS+=$(OPENSSL_LIBS) | LIBS+=-lcrypto | ||||||
|  |  | ||||||
| INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include | INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include | ||||||
| #FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX" | #FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX" | ||||||
| @ -37,7 +34,7 @@ FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(ARCH)"' | |||||||
|  |  | ||||||
| $(PRG): $(OBJS)  | $(PRG): $(OBJS)  | ||||||
| #	$(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS) | #	$(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS) | ||||||
| 	$(CC) $(LIBS) $(OBJS) -o $(PRG) $(LIBPATH) $(LDFLAGS) $(LIBS)  | 	$(CC) $(OBJS) -o $(PRG) $(LIBPATH) $(LDFLAGS) $(LIBS)  | ||||||
|  |  | ||||||
|  |  | ||||||
| clean:  | clean:  | ||||||
|  | |||||||
| @ -1,119 +0,0 @@ | |||||||
| #include <stdlib.h> |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "ac.h" |  | ||||||
| #include "conf.h" |  | ||||||
| #include "cw/capwap.h" |  | ||||||
|  |  | ||||||
| /*#include "cw/aciplist.h"*/ |  | ||||||
| #include "socklist.h" |  | ||||||
| #include "cw/sock.h" |  | ||||||
| #include "cw/dbg.h" |  | ||||||
|  |  | ||||||
| #include "wtpman.h" |  | ||||||
| #include "discovery_cache.h" |  | ||||||
|  |  | ||||||
| #include "cw/mavltypes.h" |  | ||||||
| mavl_t actube_global_cfg; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| cw_aciplist_t get_aciplist() |  | ||||||
| { |  | ||||||
| 	int i=0; |  | ||||||
|  |  | ||||||
| 	cw_aciplist_t aciplist = cw_aciplist_create(); |  | ||||||
|  |  | ||||||
| 	if(!aciplist) |  | ||||||
| 		return 0; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	for (i=0; i<socklist_len;i++){ |  | ||||||
|  |  | ||||||
| 		if (socklist[i].type != SOCKLIST_UNICAST_SOCKET) |  | ||||||
| 			break; |  | ||||||
|  |  | ||||||
| 		struct sockaddr_storage sa; |  | ||||||
| 		unsigned int salen=sizeof(sa); |  | ||||||
| 		if ( getsockname(socklist[i].sockfd,(struct sockaddr*)&sa,&salen)<0) |  | ||||||
| 			continue; |  | ||||||
|  |  | ||||||
| 		cw_acip_t * acip; |  | ||||||
| 		acip = malloc(sizeof(cw_acip_t)); |  | ||||||
| 		if (!acip) |  | ||||||
| 			continue; |  | ||||||
|  |  | ||||||
| 		sock_copyaddr(&acip->ip,(struct sockaddr*)&sa); |  | ||||||
| 		if (acip->ip.ss_family == AF_INET) |  | ||||||
| 			acip->index=11; |  | ||||||
| 		else |  | ||||||
| 			acip->index=3; |  | ||||||
| 		 |  | ||||||
|  |  | ||||||
| / * //		printf ("Adding IP %s\n",sock_addr2str(&acip->ip));	 |  | ||||||
| * / |  | ||||||
| 		cw_aciplist_add(aciplist,acip); |  | ||||||
|  |  | ||||||
| 		 |  | ||||||
| 	} |  | ||||||
| 	return aciplist; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| void * get_iplist(void * arg) |  | ||||||
| { |  | ||||||
| 	return get_aciplist(); |  | ||||||
| } |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| void release_iplist(void *arg,void *data) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| int handle_echo_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, |  | ||||||
| 		                      int len, struct sockaddr *from) |  | ||||||
| { |  | ||||||
| 	cw_dbg(DBG_X,"Handle Echo Request %p",conn->data); |  | ||||||
| //	struct wtpman * wtpman = conn->data; |  | ||||||
| //	wtpman_echo_req(wtpman); |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| /*static void setup_actions (struct mod_ac *c, struct mod_ac *b, struct cw_actiondef *actions) |  | ||||||
| { |  | ||||||
| 	cw_dbg(DBG_X,"Setup Actions! Yea"); |  | ||||||
| 	cw_set_msg_end_callback(actions,CW_STATE_RUN,CW_MSG_ECHO_REQUEST,handle_echo_req); |  | ||||||
| } |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| struct cw_DiscoveryCache * discovery_cache; |  | ||||||
|  |  | ||||||
| int ac_global_init() |  | ||||||
| { |  | ||||||
| 	/* initialize discovery cache */ |  | ||||||
| 	discovery_cache = discovery_cache_create(100); |  | ||||||
| 	if (discovery_cache==NULL) |  | ||||||
| 		goto errX; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	return 1; |  | ||||||
| errX: |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| @ -64,7 +64,7 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg) | |||||||
| 	int c; | 	int c; | ||||||
| 	opterr = 1; | 	opterr = 1; | ||||||
| 	 | 	 | ||||||
| 	bootcfg->cfgfilename = "config.ktv"; | 	bootcfg->cfgfilename = "config.atv"; | ||||||
| 	 | 	 | ||||||
| 	while ( (c = getopt (argc, argv, "vc:d:p:")) != -1) { | 	while ( (c = getopt (argc, argv, "vc:d:p:")) != -1) { | ||||||
| 		 | 		 | ||||||
| @ -103,7 +103,21 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | struct cw_DiscoveryCache * discovery_cache; | ||||||
|  | mavl_t actube_global_cfg; | ||||||
|  |  | ||||||
|  | int ac_global_init() | ||||||
|  | { | ||||||
|  | 	/* initialize discovery cache */ | ||||||
|  | 	discovery_cache = discovery_cache_create(100); | ||||||
|  | 	if (discovery_cache==NULL) | ||||||
|  | 		goto errX; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	return 1; | ||||||
|  | errX: | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -173,16 +187,6 @@ static void show_cfg (FILE *out, mavl_t ktv) | |||||||
| 	 | 	 | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int main (int argc, char *argv[]) |  | ||||||
| { |  | ||||||
| 	int rc = 0; |  | ||||||
| 	struct bootcfg bootcfg; |  | ||||||
| 	FILE * file; |  | ||||||
| 	mavl_t types_tree, global_cfg; |  | ||||||
| 	const cw_Type_t **ti; |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
| 	{ | 	{ | ||||||
| 		cw_Cfg_t * cfg; | 		cw_Cfg_t * cfg; | ||||||
| @ -211,11 +215,39 @@ return 0; | |||||||
| */ | */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int main (int argc, char *argv[]) | ||||||
|  | { | ||||||
|  | 	int rc = 0; | ||||||
|  | 	struct bootcfg bootcfg; | ||||||
|  | 	FILE * file; | ||||||
|  | 	mavl_t types_tree, acglobal_cfg; | ||||||
|  | 	const cw_Type_t **ti; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	cw_Cfg_t * global_cfg = NULL; | ||||||
|  |  | ||||||
| 	/* parse arguments */ | 	/* parse arguments */ | ||||||
| 	parse_args (argc, argv, &bootcfg); | 	parse_args (argc, argv, &bootcfg); | ||||||
|  |  | ||||||
|  | 	global_cfg=cw_cfg_create(); | ||||||
|  | 	if (!global_cfg){ | ||||||
|  | 		fprintf(stderr,"Can't create global_cfg: %s\n",strerror(errno)); | ||||||
|  | 		goto errX; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	rc = cw_cfg_load(bootcfg.cfgfilename,global_cfg); | ||||||
|  | 	if (rc) | ||||||
|  | 	{ | ||||||
|  | 		if (rc<0) | ||||||
|  | 			fprintf(stderr,"Can't load cfg '%s': %s\n",bootcfg.cfgfilename,strerror(errno)); | ||||||
|  | 		goto errX; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* open config file */ | 	/* open config file */ | ||||||
|         file = fopen(bootcfg.cfgfilename,"r"); |         file = fopen("config.ktv","r"); | ||||||
|         if (file == NULL){ |         if (file == NULL){ | ||||||
|                 cw_log(LOG_ERR,"Cant open config file '%s': %s",  |                 cw_log(LOG_ERR,"Cant open config file '%s': %s",  | ||||||
| 				bootcfg.cfgfilename, strerror(errno)); | 				bootcfg.cfgfilename, strerror(errno)); | ||||||
| @ -229,20 +261,20 @@ return 0; | |||||||
| 		mavl_insert_ptr(types_tree,*ti); | 		mavl_insert_ptr(types_tree,*ti); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	global_cfg = cw_ktv_create(); | 	acglobal_cfg = cw_ktv_create(); | ||||||
| 	if (global_cfg == NULL){ | 	if (acglobal_cfg == NULL){ | ||||||
| 		cw_log(LOG_ERR,"Can't create local_cfg: %s",strerror(errno)); | 		cw_log(LOG_ERR,"Can't create local_cfg: %s",strerror(errno)); | ||||||
| 		exit(EXIT_FAILURE); | 		exit(EXIT_FAILURE); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	cw_ktv_read_file(file,global_cfg,types_tree); | 	cw_ktv_read_file(file,acglobal_cfg,types_tree); | ||||||
|  |  | ||||||
| 	fclose(file); | 	fclose(file); | ||||||
|  |  | ||||||
| 	actube_global_cfg = global_cfg; | 	actube_global_cfg = acglobal_cfg; | ||||||
|  |  | ||||||
|  |  | ||||||
| 	cw_dbg_ktv_dump(global_cfg,DBG_INFO,NULL,"CFG:",NULL); | 	cw_dbg_ktv_dump(acglobal_cfg,DBG_INFO,NULL,"CFG:",NULL); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	cw_log_name = "AC-Tube"; | 	cw_log_name = "AC-Tube"; | ||||||
| @ -275,16 +307,6 @@ return 0; | |||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| 	/* Initialize the database */ |  | ||||||
| 	if (!db_init()) |  | ||||||
| 		goto errX; |  | ||||||
| 		 |  | ||||||
| 	/* Start the database */ |  | ||||||
| 	if (!db_start()) |  | ||||||
| 		goto errX; |  | ||||||
| 		 |  | ||||||
| 	db_ping(); |  | ||||||
| 	 |  | ||||||
|  |  | ||||||
| 	/* Init DTLS library */ | 	/* Init DTLS library */ | ||||||
| 	dtls_init(); | 	dtls_init(); | ||||||
| @ -304,6 +326,10 @@ return 0; | |||||||
| 	cw_log (LOG_INFO, "Starting AC-Tube, Name=%s, ID=%s", conf_acname, conf_acid); | 	cw_log (LOG_INFO, "Starting AC-Tube, Name=%s, ID=%s", conf_acname, conf_acid); | ||||||
| 	rc = ac_run(); | 	rc = ac_run(); | ||||||
| errX: | errX: | ||||||
|  | 	if (global_cfg) | ||||||
|  | 		mavl_destroy(global_cfg); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* XXX There is more cleanup to do */ | 	/* XXX There is more cleanup to do */ | ||||||
| 	wtplist_destroy(); | 	wtplist_destroy(); | ||||||
| 	socklist_destroy(); | 	socklist_destroy(); | ||||||
|  | |||||||
| @ -1,81 +0,0 @@ | |||||||
| #!/usr/bin/php |  | ||||||
| <?php |  | ||||||
|  |  | ||||||
| $sqlfile="./ac.sqlite3"; |  | ||||||
| if (!file_exists($sqlfile)) |  | ||||||
| 	die ("Can't open $sqlfile\n"); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class DB extends SQLite3 |  | ||||||
| { |  | ||||||
| 	function __construct() |  | ||||||
| 	{ |  | ||||||
| 		global $sqlfile; |  | ||||||
| 		$this->open($sqlfile); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| $db = new DB(); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function ls_acs() |  | ||||||
| { |  | ||||||
| 	global $db; |  | ||||||
| 	echo "List of ACs\n"; |  | ||||||
| 	echo "===========\n"; |  | ||||||
| 	$results = $db->query("SELECT  |  | ||||||
| 			acid as id,  |  | ||||||
| 			acname as name, |  | ||||||
| 			lastseen>datetime('now','-10 second') as active  |  | ||||||
| 			FROM acs ORDER by active,id,name;" |  | ||||||
| 		); |  | ||||||
| 	while ($row = $results->fetchArray(SQLITE3_ASSOC)) { |  | ||||||
| 		$o = $row['active'] ? "yes" : "no"; |  | ||||||
| 		echo "ID: $row[id], Name: $row[name] - Online: $o\n"; |  | ||||||
| 	}	 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function ls_wtps() |  | ||||||
| { |  | ||||||
| 	global $db; |  | ||||||
| 	echo "List of WTPs\n"; |  | ||||||
| 	echo "============\n"; |  | ||||||
| 	 |  | ||||||
| 	$result = $db->query("SELECT  |  | ||||||
| 			wtpid as wtpid, |  | ||||||
| 			wtps.acid as acid, |  | ||||||
| 			acs.acname as acname |  | ||||||
| 			FROM wtps  |  | ||||||
| 			LEFT join acs USING(acid) |  | ||||||
| 		"); |  | ||||||
| 	while ($row = $result->fetchArray(SQLITE3_ASSOC)) { |  | ||||||
| 		$j  = $row['acid'] ? "Joined to $row[acid]" : "Not joined"; |  | ||||||
|  |  | ||||||
| 		echo "ID: $row[wtpid], $j\n"; |  | ||||||
| 	}	 |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function print_help() |  | ||||||
| { |  | ||||||
| 	echo "acshell <cmd>\n"; |  | ||||||
| 	echo "\n"; |  | ||||||
| 	echo "acshell lsacs - list acs\n"; |  | ||||||
| 	echo "acshell lswtp - list wtps\n"; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| //ls_wtps(); |  | ||||||
| // |  | ||||||
| //var_dump($argv); |  | ||||||
| if (count($argv)==1){ |  | ||||||
| 	print_help(); |  | ||||||
| 	exit(0); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| if( $argv[1] == "lsacs" )  |  | ||||||
| 	ls_acs(); |  | ||||||
| if( $argv[1] == "lswtps" )  |  | ||||||
| 	ls_wtps(); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -82,7 +82,6 @@ int conf_ac_ips_len; | |||||||
| char *conf_sslcertfilename = NULL; | char *conf_sslcertfilename = NULL; | ||||||
| char *conf_sslkeyfilename = NULL; | char *conf_sslkeyfilename = NULL; | ||||||
| char *conf_sslkeypass = NULL; | char *conf_sslkeypass = NULL; | ||||||
| char *conf_sslcipher = NULL; |  | ||||||
| char *conf_dtls_psk = NULL; | char *conf_dtls_psk = NULL; | ||||||
|  |  | ||||||
| int conf_security = 0; | int conf_security = 0; | ||||||
| @ -676,7 +675,6 @@ int read_config(const char *filename) | |||||||
| 		CFG_SIMPLE_STR("ssl_cert", &conf_sslcertfilename), | 		CFG_SIMPLE_STR("ssl_cert", &conf_sslcertfilename), | ||||||
| 		CFG_SIMPLE_STR("ssl_key", &conf_sslkeyfilename), | 		CFG_SIMPLE_STR("ssl_key", &conf_sslkeyfilename), | ||||||
| 		CFG_SIMPLE_STR("ssl_key_pass", &conf_sslkeypass), | 		CFG_SIMPLE_STR("ssl_key_pass", &conf_sslkeypass), | ||||||
| 		CFG_SIMPLE_STR("ssl_cipher", &conf_sslcipher), |  | ||||||
| 		CFG_SIMPLE_STR("dtls_psk", &conf_dtls_psk), | 		CFG_SIMPLE_STR("dtls_psk", &conf_dtls_psk), | ||||||
|  |  | ||||||
| 		CFG_SIMPLE_BOOL("dtls_verify_peer", &conf_dtls_verify_peer), | 		CFG_SIMPLE_BOOL("dtls_verify_peer", &conf_dtls_verify_peer), | ||||||
| @ -757,10 +755,10 @@ int read_config(const char *filename) | |||||||
| 	if (!init_dtls()) | 	if (!init_dtls()) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
| 	if (!conf_sslcipher) | /*	if (!conf_sslcipher) | ||||||
| 		conf_sslcipher = CAPWAP_CIPHER; | 		conf_sslcipher = CAPWAP_CIPHER; | ||||||
|  |  | ||||||
| 	if (!conf_image_dir) | */	if (!conf_image_dir) | ||||||
| 		conf_image_dir = CONF_DEFAULT_IMAGE_DIR; | 		conf_image_dir = CONF_DEFAULT_IMAGE_DIR; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -115,7 +115,7 @@ extern char *conf_sslkeyfilename; | |||||||
| extern char *conf_sslkeypass; | extern char *conf_sslkeypass; | ||||||
| extern char *conf_dtls_psk; | extern char *conf_dtls_psk; | ||||||
| extern int conf_dtls_verify_peer; | extern int conf_dtls_verify_peer; | ||||||
| char *conf_sslcipher; | extern char *conf_sslcipher; | ||||||
|  |  | ||||||
| extern char *conf_image_dir; | extern char *conf_image_dir; | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,838 +0,0 @@ | |||||||
| /* |  | ||||||
|     This file is part of actube. |  | ||||||
|  |  | ||||||
|     actube 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 3 of the License, or |  | ||||||
|     (at your option) any later version. |  | ||||||
|  |  | ||||||
|     libcapwap 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 Foobar.  If not, see <http://www.gnu.org/licenses/>. |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| #include <stdlib.h> |  | ||||||
| #include <stdint.h> |  | ||||||
| #include <string.h> |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <errno.h> |  | ||||||
| #include <unistd.h> // sleep |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "cw/capwap.h" |  | ||||||
| #include "cw/sock.h" |  | ||||||
| #include "cw/log.h" |  | ||||||
| #include "cw/timer.h" |  | ||||||
| #include "cw/cw.h" |  | ||||||
|  |  | ||||||
| #include "cw/dtls.h" |  | ||||||
| #include "cw/dbg.h" |  | ||||||
| #include "cw/conn.h" |  | ||||||
| #include "cw/format.h" |  | ||||||
|  |  | ||||||
| #include "ac.h" |  | ||||||
| #include "conf.h" |  | ||||||
| #include "db.h" |  | ||||||
| #include "socklist.h" |  | ||||||
| #include "wtpman.h" |  | ||||||
| #include "wtplist.h" |  | ||||||
| #include "cw/ktv.h" |  | ||||||
|  |  | ||||||
| static void reset_echointerval_timer(struct wtpman *wtpman) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| /*	uint16_t ct = mbag_get_word(wtpman->conn->local, CW_ITEM_CAPWAP_TIMERS, |  | ||||||
| 				    CW_MAX_DISCOVERY_INTERVAL << 8 | |  | ||||||
| 				    CAPWAP_ECHO_INTERVAL); |  | ||||||
| */ |  | ||||||
| 	/* start echinterval timer and put 2 seconds for "safety" on it */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //	wtpman->echointerval_timer = cw_timer_start(2+ (ct & 0xff)); |  | ||||||
| //	db_ping_wtp(sock_addr2str_p(&wtpman->conn->addr,sock_buf), conf_acname); |  | ||||||
| //	cw_dbg(DBG_X, "Starting capwap timer: %d", wtpman->echointerval_timer); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static int msg_start_handler(struct conn *conn, struct cw_action_in *a, uint8_t * data, |  | ||||||
| 			     int len, struct sockaddr *from) |  | ||||||
| { |  | ||||||
| 	struct wtpman *wtpman = conn->data; |  | ||||||
| 	reset_echointerval_timer(wtpman); |  | ||||||
|  |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void wtpman_remove(struct wtpman *wtpman) |  | ||||||
| { |  | ||||||
| 	wtplist_lock(); |  | ||||||
| 	wtplist_remove(wtpman); |  | ||||||
| 	wtplist_unlock(); |  | ||||||
| 	wtpman_destroy(wtpman); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void wtpman_run_discovery(void *arg) |  | ||||||
| { |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) arg; |  | ||||||
|  |  | ||||||
| 	time_t timer = cw_timer_start(10); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY; |  | ||||||
| /*//	wtpman->conn->actions = &capwap_actions;*/ |  | ||||||
|  |  | ||||||
| /*	wtpman->conn->outgoing = mbag_create(); |  | ||||||
| 	wtpman->conn->incomming = mbag_create(); |  | ||||||
| */	 |  | ||||||
| 	wtpman->conn->remote_cfg = cw_ktv_create(); /*//mavl_cmp_kv,NULL,1312);*/ |  | ||||||
|  |  | ||||||
| 	while (!cw_timer_timeout(timer) |  | ||||||
| 	       && wtpman->conn->capwap_state == CAPWAP_STATE_DISCOVERY) { |  | ||||||
| 		cw_read_messages(wtpman->conn); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //	struct mbag_item *wn = mbag_get(wtpman->conn->incomming, CW_ITEM_WTP_NAME); |  | ||||||
|  |  | ||||||
| //	if (wn) { |  | ||||||
| //              printf("WTP Name: %s\n", wn->data); |  | ||||||
| //              exit(0); |  | ||||||
| //	} |  | ||||||
| */ |  | ||||||
| 	wtpman_remove(wtpman); |  | ||||||
| 	return; |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int xprocess_message(struct conn *conn, uint8_t * rawmsg, int rawlen, |  | ||||||
| 		     struct sockaddr *from) |  | ||||||
| { |  | ||||||
| 	uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg); |  | ||||||
| 	uint32_t type = cw_get_msg_type(msgptr); |  | ||||||
| 	cw_log(LOG_ERR, "Hey: %d", type); |  | ||||||
| 	if (type == CAPWAP_MSG_DISCOVERY_REQUEST) |  | ||||||
| 		conn->capwap_state = CAPWAP_STATE_DISCOVERY; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	return process_message(conn, rawmsg, rawlen, from); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static int wtpman_establish_dtls(void *arg) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) arg; |  | ||||||
|  |  | ||||||
| 	/* setup cipher */ |  | ||||||
| 	wtpman->conn->dtls_cipher = conf_sslcipher; |  | ||||||
|  |  | ||||||
| 	/* setup DTSL certificates */ |  | ||||||
| 	int dtls_ok = 0; |  | ||||||
| 	if (conf_sslkeyfilename && conf_sslcertfilename) { |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 		wtpman->conn->dtls_key_file = conf_sslkeyfilename; |  | ||||||
| 		wtpman->conn->dtls_cert_file = conf_sslcertfilename; |  | ||||||
| 		wtpman->conn->dtls_key_pass = conf_sslkeypass; |  | ||||||
| 		wtpman->conn->dtls_verify_peer = conf_dtls_verify_peer; |  | ||||||
| 		cw_dbg(DBG_DTLS, "Using key file %s", wtpman->conn->dtls_key_file); |  | ||||||
| 		cw_dbg(DBG_DTLS, "Using cert file %s", wtpman->conn->dtls_cert_file); |  | ||||||
| 		dtls_ok = 1; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* setup DTLS psk */ |  | ||||||
| 	if (conf_dtls_psk) { |  | ||||||
| 		wtpman->conn->dtls_psk = conf_dtls_psk; |  | ||||||
| 		wtpman->conn->dtls_psk_len = strlen(conf_dtls_psk); |  | ||||||
| 		dtls_ok = 1; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (!dtls_ok) { |  | ||||||
| 		cw_log(LOG_ERR, |  | ||||||
| 		       "Can't establish DTLS session, neither psk nor certs set in config file."); |  | ||||||
| 		return 0; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* try to accept the connection */ |  | ||||||
| 	if (!dtls_accept(wtpman->conn)) { |  | ||||||
| 		cw_dbg(DBG_DTLS, "Error establishing DTLS session with %s", |  | ||||||
| 		       sock_addr2str_p(&wtpman->conn->addr,sock_buf)); |  | ||||||
| 		return 0; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	cw_dbg(DBG_DTLS, "DTLS session established with %s, cipher=%s", |  | ||||||
| 	       sock_addr2str_p(&wtpman->conn->addr,sock_buf), dtls_get_cipher(wtpman->conn)); |  | ||||||
|  |  | ||||||
| 	return 1; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static int wtpman_join(void *arg, time_t timer) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) arg; |  | ||||||
| 	struct conn *conn = wtpman->conn; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //	wtpman->conn->outgoing = mbag_create(); |  | ||||||
| //	wtpman->conn->incomming = mbag_create(); |  | ||||||
| //	conn->config = conn->incomming; |  | ||||||
| //      wtpman->conn->local = ac_config; |  | ||||||
|  |  | ||||||
| //	mbag_set_str(conn->local, CW_ITEM_AC_NAME, conf_acname); |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	wtpman->conn->capwap_state = CAPWAP_STATE_JOIN; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //	wtpman->conn->actions = &capwap_actions; |  | ||||||
|  |  | ||||||
| //      wtpman->conn->itemstore = mbag_create(); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	cw_dbg(DBG_INFO, "Join State - %s", sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
|  |  | ||||||
| 	int rc; |  | ||||||
| 	while (!cw_timer_timeout(timer) && wtpman->conn->capwap_state == CAPWAP_STATE_JOIN) { |  | ||||||
| 		rc = cw_read_messages(wtpman->conn); |  | ||||||
| 		if (rc < 0) { |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (rc != 0) { |  | ||||||
| 		cw_log(LOG_ERR, "Error joining WTP %s", cw_strerror(rc)); |  | ||||||
| 		return 0; |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	if (wtpman->conn->capwap_state == CAPWAP_STATE_JOIN) { |  | ||||||
| 		cw_dbg(DBG_MSG_ERR, "No join request from %s after %d seconds, WTP died.", |  | ||||||
| 		       sock_addr2str(&wtpman->conn->addr,sock_buf), wtpman->conn->wait_dtls); |  | ||||||
|  |  | ||||||
| 		return 0; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	return 1; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void wtpman_image_data(struct wtpman *wtpman) |  | ||||||
| { |  | ||||||
| /*	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| 	struct conn *conn = wtpman->conn; |  | ||||||
|  |  | ||||||
| 	// Image upload  |  | ||||||
| 	const char *filename = mbag_get_str(conn->outgoing, CW_ITEM_IMAGE_FILENAME, NULL); |  | ||||||
| 	if (!filename) { |  | ||||||
| 		cw_log(LOG_ERR, |  | ||||||
| 		       "Can't send image to %s. No Image Filename Item found.", |  | ||||||
| 		       sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	cw_dbg(DBG_INFO, "Sending image file '%s' to '%s'.", filename, |  | ||||||
| 	       sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
| 	FILE *infile = fopen(filename, "rb"); |  | ||||||
| 	if (infile == NULL) { |  | ||||||
| 		cw_log(LOG_ERR, "Can't open image %s: %s", |  | ||||||
| 		       sock_addr2str(&conn->addr,sock_buf), strerror(errno)); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	CW_CLOCK_DEFINE(clk); |  | ||||||
| 	cw_clock_start(&clk); |  | ||||||
|  |  | ||||||
| 	mbag_item_t *eof = mbag_set_const_ptr(conn->outgoing, CW_ITEM_IMAGE_FILEHANDLE, |  | ||||||
| 					      infile); |  | ||||||
|  |  | ||||||
| 	int rc = 0; |  | ||||||
| 	while (conn->capwap_state == CW_STATE_IMAGE_DATA && rc == 0 && eof != NULL) { |  | ||||||
| 		rc = cw_send_request(conn, CAPWAP_MSG_IMAGE_DATA_REQUEST); |  | ||||||
| 		eof = mbag_get(conn->outgoing, CW_ITEM_IMAGE_FILEHANDLE); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	if (rc) { |  | ||||||
| 		cw_log(LOG_ERR, "Error sending image to %s: %s", |  | ||||||
| 		       sock_addr2str(&conn->addr,sock_buf), cw_strrc(rc)); |  | ||||||
| 	} else { |  | ||||||
| 		cw_dbg(DBG_INFO, "Image '%s' sucessful sent to %s in %0.1f seconds.", |  | ||||||
| 		       filename, sock_addr2str(&conn->addr,sock_buf), cw_clock_stop(&clk)); |  | ||||||
| 		conn->capwap_state = CW_STATE_NONE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	fclose(infile); |  | ||||||
| 	wtpman_remove(wtpman); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void config_to_sql(struct conn *conn) |  | ||||||
| { |  | ||||||
| 	 |  | ||||||
| /* |  | ||||||
| 	// XXX for the moment we use just the IP adress as ID |  | ||||||
| 	char *wtp_id = sock_addr2str(&conn->addr); |  | ||||||
|  |  | ||||||
| //	cw_dbg(DBG_X, "WTPID: %s\n", wtp_id); |  | ||||||
|  |  | ||||||
| 	MAVLITER_DEFINE(it, conn->incomming); |  | ||||||
| 	mavliter_foreach(&it) { |  | ||||||
| 		mbag_item_t *i = mavliter_get(&it); |  | ||||||
|  |  | ||||||
| 		const struct cw_itemdef *cwi = |  | ||||||
| 		    cw_itemdef_get(conn->actions->items, i->id, NULL); |  | ||||||
|  |  | ||||||
| 		cw_dbg(DBG_X,"ID GOT: %s",i->id); |  | ||||||
|  |  | ||||||
| 		if (cwi) { |  | ||||||
| 			DBGX("SQL ID %s,%s", i->id, cwi->id); |  | ||||||
| 			DBGX("SQL Type %s,Typecwd %s", i->type->name, cwi->type->name); |  | ||||||
|  |  | ||||||
| 			//              printf("%s != %s ?\n",i->type->name,cwi->type->name); |  | ||||||
| 			char str[256]; |  | ||||||
| 			if (i->type->to_str) { |  | ||||||
| 				i->type->to_str(i, str); |  | ||||||
| 				db_put_wtp_prop(wtp_id, cwi->id, cwi->sub_id, str); |  | ||||||
| 			} else { |  | ||||||
| 				cw_log(LOG_ERR, "Can't converto to str for %s", cwi->id, |  | ||||||
| 				       cwi->sub_id); |  | ||||||
|  |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 		} else { |  | ||||||
| 			//      DBGX("ID %d",i->id); |  | ||||||
|  |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
| */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void xradio_to_sql(struct conn *conn, char *wtp_id, int rid, int radio) |  | ||||||
| { |  | ||||||
| 	 |  | ||||||
| /*	 |  | ||||||
| 	MAVLITER_DEFINE(it, radio); |  | ||||||
| 	mavliter_foreach(&it) { |  | ||||||
| 		mbag_item_t *i = mavliter_get(&it); |  | ||||||
|  |  | ||||||
| 		const struct cw_itemdef *cwi = |  | ||||||
| 		    cw_itemdef_get(conn->actions->radioitems, i->id, NULL); |  | ||||||
| 		if (cwi) { |  | ||||||
| 			char str[4096]; |  | ||||||
| 			if (i->type->to_str) { |  | ||||||
| 				i->type->to_str(i, str); |  | ||||||
| //				printf("I would put RID: %d, %s=>%s\n",rid,cwi->id,str); |  | ||||||
|  |  | ||||||
| 				char srid[6]; |  | ||||||
| 				sprintf(srid,"%d",rid); |  | ||||||
|  |  | ||||||
| 				db_put_radio_prop(wtp_id,srid,cwi->id,cwi->sub_id,str); |  | ||||||
|  |  | ||||||
| //				db_put_wtp_prop(wtp_id, cwi->id, cwi->sub_id, str); |  | ||||||
| 			} else { |  | ||||||
| 				cw_log(LOG_ERR, "Can't converto to str for %s", cwi->id, |  | ||||||
| 				       cwi->sub_id); |  | ||||||
|  |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 		} else { |  | ||||||
| 			//      DBGX("ID %d",i->id); |  | ||||||
|  |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| //		int rid = ((struct mbag_item*)mavliter_get(&it))->iid; |  | ||||||
| */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| void radios_to_sql(struct conn *conn) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| 	char *wtp_id = sock_addr2str(&conn->addr,sock_buf); |  | ||||||
| 	MAVLITER_DEFINE(it, conn->radios); |  | ||||||
| 	mavliter_foreach(&it) { |  | ||||||
| 		struct mbag_item * i = mavliter_get(&it); |  | ||||||
| 		int rid = i->u1.iid; |  | ||||||
|  |  | ||||||
| 		radio_to_sql(conn,wtp_id,rid,i->u2.data); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void wtpman_run_data(void *wtpman_arg) |  | ||||||
| { |  | ||||||
|  |  | ||||||
| 	return; |  | ||||||
|  |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) wtpman_arg; |  | ||||||
| 	struct conn *conn = wtpman->conn; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	uint8_t data[1001]; |  | ||||||
| 	memset(data, 0, 1000); |  | ||||||
|  |  | ||||||
| 	cw_log(LOG_ERR, "I am the data thread**********************************************************************\n"); |  | ||||||
| 	while (1) { |  | ||||||
| 		sleep(5); |  | ||||||
| /*//		conn->write_data(conn, data, 100);*/ |  | ||||||
| 		cw_log(LOG_ERR, "O was the data thread***********************************************************\n"); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static int msg_end_handler(struct conn *conn, struct cw_action_in *a, uint8_t * data, |  | ||||||
| 			     int len, struct sockaddr *from) |  | ||||||
| { |  | ||||||
| /*	if (a->msg_id ==CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST) { |  | ||||||
| 		props_to_sql(conn,conn->incomming,0); |  | ||||||
| 		radios_to_sql(conn); |  | ||||||
| 	} |  | ||||||
| */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void wtpman_run(void *arg) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
|  |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) arg; |  | ||||||
|  |  | ||||||
| 	wtpman->conn->seqnum = 0; |  | ||||||
| 	struct conn *conn = wtpman->conn; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* reject connections to our multi- or broadcast sockets */ |  | ||||||
| /*	if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) { |  | ||||||
| 		cw_dbg(DBG_DTLS, "Dropping connection from %s to non-unicast socket.", |  | ||||||
| 		       CLIENT_IP); |  | ||||||
| 		wtpman_remove(wtpman); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	time_t timer = cw_timer_start(wtpman->conn->wait_dtls); |  | ||||||
|  |  | ||||||
| 	/* establish dtls session */ |  | ||||||
| /*	if (!wtpman_establish_dtls(wtpman)) { |  | ||||||
| 		wtpman_remove(wtpman); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	/* dtls is established, goto join state */ |  | ||||||
| 	if (!wtpman_join(wtpman, timer)) { |  | ||||||
| 		wtpman_remove(wtpman); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	conn->msg_start = msg_start_handler; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	cw_dbg(DBG_INFO, "WTP from %s has joined with session id: %s", |  | ||||||
| 			sock_addr2str_p(&conn->addr,sock_buf), |  | ||||||
| 			format_bin2hex(conn->session_id,16)); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //	cw_dbg(DBG_INFO, "Creating data thread"); |  | ||||||
| //	pthread_t thread; |  | ||||||
| //	pthread_create(&thread, NULL, (void *) wtpman_run_data, (void *) wtpman); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	/* here the WTP has joined, now we assume an image data request   |  | ||||||
| 	   or an configuration status request. Nothing else.  |  | ||||||
| 	 */ |  | ||||||
|  |  | ||||||
| 	int rc = 0; |  | ||||||
| 	while (!cw_timer_timeout(timer) |  | ||||||
| 	       && wtpman->conn->capwap_state == CW_STATE_CONFIGURE) { |  | ||||||
| 		rc = cw_read_messages(wtpman->conn); |  | ||||||
| 		if (rc < 0) { |  | ||||||
| 			if (errno != EAGAIN) |  | ||||||
| 				break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (!cw_result_is_ok(rc)) { |  | ||||||
| 		cw_dbg(DBG_INFO, "WTP Problem: %s", cw_strrc(rc)); |  | ||||||
| 		wtpman_remove(wtpman); |  | ||||||
| 		return; |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	if (conn->capwap_state == CW_STATE_IMAGE_DATA) { |  | ||||||
| 		wtpman_image_data(wtpman); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	conn->capwap_state = CW_STATE_RUN; |  | ||||||
| /* |  | ||||||
| 	// XXX testing ... |  | ||||||
| //	DBGX("Cofig to sql", ""); |  | ||||||
| //	props_to_sql(conn,conn->incomming,0); |  | ||||||
| //	radios_to_sql(conn); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	conn->msg_end=msg_end_handler; |  | ||||||
| 	/* The main run loop */ |  | ||||||
| 	reset_echointerval_timer(wtpman); |  | ||||||
|  |  | ||||||
| 	rc = 0; |  | ||||||
| 	while (wtpman->conn->capwap_state == CW_STATE_RUN) { |  | ||||||
| 		rc = cw_read_messages(wtpman->conn); |  | ||||||
| 		if (rc < 0) { |  | ||||||
| 			if (errno != EAGAIN) |  | ||||||
| 				break; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| /*//		cw_dbg(DBG_X, "Time left: %d", |  | ||||||
| //*/ |  | ||||||
| 		       cw_timer_timeleft(wtpman->echointerval_timer); |  | ||||||
| 		if (cw_timer_timeout(wtpman->echointerval_timer)) { |  | ||||||
|  |  | ||||||
| 			cw_dbg(DBG_INFO, "Lost connection to WTP:%s", |  | ||||||
| 			       sock_addr2str_p(&conn->addr,sock_buf)); |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //		mavl_del_all(conn->outgoing); |  | ||||||
| //		conn_clear_upd(conn,1); |  | ||||||
|  |  | ||||||
| //	props_to_sql(conn,conn->incomming,0); |  | ||||||
| //	radios_to_sql(conn); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 		mavl_t r; |  | ||||||
| 		r = db_get_update_tasks(conn, sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
| 		if (r) { |  | ||||||
|  |  | ||||||
| 	/*		 |  | ||||||
| //			if (!conn->outgoing->count) |  | ||||||
| //				continue; |  | ||||||
| */ |  | ||||||
| 			cw_dbg(DBG_INFO, "Updating WTP %s",sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
|  |  | ||||||
| 			rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //			mavl_merge(conn->config, conn->outgoing); |  | ||||||
| //			mavl_destroy(conn->outgoing); |  | ||||||
| //			conn->outgoing = mbag_create(); |  | ||||||
| //			props_to_sql(conn,conn->incomming,0); |  | ||||||
| //			radios_to_sql(conn); |  | ||||||
| //			mavl_destroy(r); |  | ||||||
| */ |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		r = db_get_radio_tasks(conn, sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
| 		if (r) { |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| 			//			if (!conn->radios_upd->count) |  | ||||||
| //				continue; |  | ||||||
| */ |  | ||||||
| 			cw_dbg(DBG_INFO, "Updating Radios for %s",sock_addr2str(&conn->addr,sock_buf)); |  | ||||||
| 			rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //			conn_clear_upd(conn,1); |  | ||||||
|  |  | ||||||
| //			mavl_destroy(conn->radios_upd); |  | ||||||
| //			conn->radios_upd=mbag_i_create(); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| //			radios_to_sql(conn); |  | ||||||
| */ |  | ||||||
| 			/* |  | ||||||
| 			rc = cw_send_request(conn, CW_MSG_CONFIGURATION_UPDATE_REQUEST); |  | ||||||
| 			mavl_merge(conn->config, conn->outgoing); |  | ||||||
| 			mavl_destroy(conn->outgoing); |  | ||||||
| 			conn->outgoing = mbag_create(); |  | ||||||
| 			config_to_sql(conn); |  | ||||||
| 			radios_to_sql(conn); |  | ||||||
| 			mavl_destroy(r); |  | ||||||
| 			*/ |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	db_ping_wtp(sock_addr2str_p(&conn->addr,sock_buf), ""); |  | ||||||
| 	wtpman_remove(wtpman); |  | ||||||
| 	return; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void wtpman_run_dtls(void *arg) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| 	struct wtpman *wtpman = (struct wtpman *) arg; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* reject connections to our multi- or broadcast sockets */ |  | ||||||
| 	if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) { |  | ||||||
| 		cw_dbg(DBG_DTLS, "Dropping connection from %s to non-unicast socket.", |  | ||||||
| 		       sock_addr2str_p(&wtpman->conn->addr,sock_buf)); |  | ||||||
| 		wtpman_remove(wtpman); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| /*//      time_t timer = cw_timer_start(wtpman->conn->wait_dtls);*/ |  | ||||||
|  |  | ||||||
| 	/* establish dtls session */ |  | ||||||
| 	if (!wtpman_establish_dtls(wtpman)) { |  | ||||||
| 		wtpman_remove(wtpman); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	wtpman_run(arg); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void wtpman_destroy(struct wtpman *wtpman) |  | ||||||
| { |  | ||||||
| 	if (wtpman->conn) |  | ||||||
| 		conn_destroy(wtpman->conn); |  | ||||||
| 	free(wtpman); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr) |  | ||||||
| { |  | ||||||
| 	char sock_buf[SOCK_ADDR_BUFSIZE]; |  | ||||||
| 	struct wtpman *wtpman; |  | ||||||
| 	wtpman = malloc(sizeof(struct wtpman)); |  | ||||||
| 	if (!wtpman) |  | ||||||
| 		return 0; |  | ||||||
| 	memset(wtpman, 0, sizeof(struct wtpman)); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	int replyfd; |  | ||||||
| 	if (socklist[socklistindex].type != SOCKLIST_UNICAST_SOCKET) { |  | ||||||
|  |  | ||||||
| 		int port = sock_getport(&socklist[socklistindex].addr); |  | ||||||
| 		replyfd = socklist_find_reply_socket(srcaddr, port); |  | ||||||
|  |  | ||||||
| 		if (replyfd == -1) { |  | ||||||
| 			cw_log(LOG_ERR, "Can't find reply socket for request from %s", |  | ||||||
| 			       sock_addr2str(srcaddr,sock_buf)); |  | ||||||
| 			free(wtpman); |  | ||||||
| 			return NULL; |  | ||||||
| 		} |  | ||||||
| 	} else { |  | ||||||
| 		replyfd = socklist[socklistindex].sockfd; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	int sockfd = replyfd;	/*//socklist[socklistindex].reply_sockfd; |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	struct sockaddr dbgaddr; |  | ||||||
| 	socklen_t dbgaddrl = sizeof(dbgaddr); |  | ||||||
| 	getsockname(sockfd, &dbgaddr, &dbgaddrl); |  | ||||||
|  |  | ||||||
| 	cw_dbg(DBG_INFO, "Creating wtpman on socket %d, %s:%d", sockfd, |  | ||||||
| 	       sock_addr2str(&dbgaddr,sock_buf), sock_getport(&dbgaddr)); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //extern int conn_process_packet2(struct conn *conn, uint8_t * packet, int len, |  | ||||||
| //                        struct sockaddr *from); |  | ||||||
| */ |  | ||||||
| 	wtpman->conn = conn_create(sockfd, srcaddr, 100); |  | ||||||
| 	wtpman->conn->role = CW_ROLE_AC; |  | ||||||
|  |  | ||||||
| 	wtpman->conn->data_sock = socklist[socklistindex].data_sockfd; |  | ||||||
| 	sock_copyaddr(&wtpman->conn->data_addr, (struct sockaddr *) &wtpman->conn->addr); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //      wtpman->conn->process_packet = conn_process_packet2; |  | ||||||
| */ |  | ||||||
| 	if (!wtpman->conn) { |  | ||||||
| 		wtpman_destroy(wtpman); |  | ||||||
| 		return NULL; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	wtpman->conn->mods = conf_mods; |  | ||||||
|  |  | ||||||
| 	wtpman->conn->strict_capwap = conf_strict_capwap; |  | ||||||
| 	wtpman->conn->strict_hdr = conf_strict_headers; |  | ||||||
| /* |  | ||||||
| //	wtpman->conn->radios = mbag_i_create(); |  | ||||||
| //	wtpman->conn->radios_upd = mbag_i_create(); |  | ||||||
| //	wtpman->conn->local = ac_config; |  | ||||||
| //wtpman->conn->capwap_mode=0; //CW_MODE_STD; //CISCO; |  | ||||||
| //	wtpman->conn->capwap_mode = CW_MODE_CISCO; |  | ||||||
| //wtpman->conn->strict_capwap_hdr=0; |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	wtpman->conn->local_cfg = cw_ktv_create(); |  | ||||||
| 	wtpman->conn->global_cfg = actube_global_cfg; |  | ||||||
| 	wtpman->conn->local_cfg = actube_global_cfg; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	return wtpman; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void wtpman_addpacket(struct wtpman *wtpman, uint8_t * packet, int len) |  | ||||||
| { |  | ||||||
| 	conn_q_add_packet(wtpman->conn, packet, len); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int nodtls = 0; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void wtpman_start(struct wtpman *wtpman, int dtlsmode) |  | ||||||
| { |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	if (dtlsmode) { |  | ||||||
| 		cw_dbg(DBG_INFO, "Starting wtpman in DTLS mode"); |  | ||||||
| 		pthread_create(&wtpman->thread, NULL, (void *) wtpman_run_dtls, |  | ||||||
| 			       (void *) wtpman); |  | ||||||
| 	} else { |  | ||||||
| 		cw_dbg(DBG_INFO, "Starting wtpman in non-dtls mode"); |  | ||||||
|  |  | ||||||
| 		if (nodtls) { |  | ||||||
| 			wtpman->conn->process_message = xprocess_message; |  | ||||||
| 			pthread_create(&wtpman->thread, NULL, (void *) wtpman_run, |  | ||||||
| 				       (void *) wtpman); |  | ||||||
| 			return; |  | ||||||
|  |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		pthread_create(&wtpman->thread, NULL, (void *) wtpman_run_discovery, |  | ||||||
| 			       (void *) wtpman); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void wtpman_lw_addpacket(struct wtpman *wtpman, uint8_t * packet, int len) |  | ||||||
| { |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	//      uint8_t * m = packet+12; |  | ||||||
| //      int l = LWTH_GET_LENGTH(packet+6); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	uint8_t *msg = packet + 12; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	int msgtype = LWMSG_GET_TYPE(msg); |  | ||||||
| 	int msglen = LWMSG_GET_LEN(msg); |  | ||||||
| 	printf("Type is %d, Len is %d\n", msgtype, msglen); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //      uint8_t *msgdata = LWMSG_GET_DATA(msg); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| 	int c=0;  |  | ||||||
| 	while (c < msglen){ |  | ||||||
| 		int eltype = LWMSGELEM_GET_TYPE(data); |  | ||||||
| 		int ellen = LWMSGELEM_GET_LEN(data); |  | ||||||
| 		printf ("ELEM TYPE: %d, LEN: %d\n",eltype,ellen); |  | ||||||
| 		c+=ellen+3; |  | ||||||
| 		data=data+ellen+3; |  | ||||||
| 	}	 |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| 	/*//uint8_t *data;*/ |  | ||||||
| 	 |  | ||||||
| /* |  | ||||||
| 	lw_foreach_msgelem(data,msgdata,msglen){ |  | ||||||
| 		int eltype = LWMSGELEM_GET_TYPE(data); |  | ||||||
| 		int ellen = LWMSGELEM_GET_LEN(data); |  | ||||||
| 		uint8_t * eldata = LWMSGELEM_GET_DATA(data); |  | ||||||
|  |  | ||||||
| 		wtpinfo_lwreadelem_wtp_descriptor(&wtpman->wtpinfo,eltype,eldata,ellen); |  | ||||||
|  |  | ||||||
| 		printf ("ELEM TYPE: %d, LEN: %d\n",eltype,ellen); |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| //      char wi[4096]; |  | ||||||
| //      wtpinfo_print(wi, &wtpman->wtpinfo); |  | ||||||
| //      printf("WTPINFO: \n%s\n", wi); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| //      char buffer[2048]; |  | ||||||
| //      struct lwmsg lwmsg; |  | ||||||
| //      lwmsg_init(&lwmsg, buffer,conf_macaddress,LWMSG_DISCOVERY_RESPONSE,conn_get_next_seqnum(wtpman->conn)); |  | ||||||
|  |  | ||||||
| //      conn_send_packet(wtpman->conn,buffer,60); |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| void wtpman_lw_start(struct wtpman *wtpman) |  | ||||||
| { |  | ||||||
|  |  | ||||||
| } |  | ||||||
| */ |  | ||||||
| @ -1,65 +0,0 @@ | |||||||
| #ifndef __WTPMAN_H |  | ||||||
| #define __WTPMAN_H |  | ||||||
|  |  | ||||||
| #include <sys/socket.h> |  | ||||||
| #include <semaphore.h> |  | ||||||
| #include <pthread.h> |  | ||||||
|  |  | ||||||
| #include "cw/capwap.h" |  | ||||||
| #include "cw/fragman.h" |  | ||||||
| #include "cw/timer.h" |  | ||||||
|  |  | ||||||
| #define WTPMAN_QSIZE 1024 |  | ||||||
|  |  | ||||||
| struct wtpman{ |  | ||||||
| 	pthread_t thread; |  | ||||||
|  |  | ||||||
| 	/* packet queue */ |  | ||||||
| /*	uint8_t * q[WTPMAN_QSIZE]; |  | ||||||
| 	int qrpos; |  | ||||||
| 	int qwpos; |  | ||||||
| 	sem_t q_sem; |  | ||||||
| */ |  | ||||||
| 	struct conn * conn; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/* wtp data */ |  | ||||||
| 	uint8_t * wtp_name; |  | ||||||
| 	uint8_t * wtp_location; |  | ||||||
| 	uint8_t * session_id; |  | ||||||
| 	uint8_t wtp_mactype; |  | ||||||
|  |  | ||||||
| /*	//struct wtpinfo wtpinfo;*/ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	int socklistindex; |  | ||||||
| 	int connected; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	cw_timer_t echointerval_timer;  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| struct wtp{ |  | ||||||
| 		 |  | ||||||
|  |  | ||||||
| }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| //extern void wtpman_run(void *arg); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| extern struct wtpman * wtpman_create(); |  | ||||||
|  |  | ||||||
| extern struct wtpman * wtpman_create(int socklistindex,struct sockaddr * srcaddr); |  | ||||||
|  |  | ||||||
| extern void wtpman_addpacket(struct wtpman * wtpman,uint8_t *packet,int len); |  | ||||||
| extern void wtpman_destroy(struct wtpman * wtpman); |  | ||||||
| extern void wtpman_start(struct wtpman * wtpman,int dtlsmode); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @ -1,5 +1,5 @@ | |||||||
| include ../Defs.mak | include ../Defs.mak | ||||||
| MFDEPS=../Defs.mak ../LocalDefs.mak | MFDEPS=../Defs.mak  | ||||||
|  |  | ||||||
|  |  | ||||||
| CWSRC=\ | CWSRC=\ | ||||||
| @ -256,7 +256,7 @@ OBJDIR          := ../../obj/cw/$(KERNEL)/$(ARCH) | |||||||
| SNAME           := $(LIBARCHDIR)/libcw.a | SNAME           := $(LIBARCHDIR)/libcw.a | ||||||
| DNAME           := $(LIBARCHDIR)/libcw.so | DNAME           := $(LIBARCHDIR)/libcw.so | ||||||
|  |  | ||||||
| CFLAGS+=-fPIC -DUSE_OPENSSL -O0 -I../../include | CFLAGS+=-fPIC -DUSE_OPENSSL -O0 -I../../include -I/usr/local/include | ||||||
| CFLAGS+=-g  | CFLAGS+=-g  | ||||||
|  |  | ||||||
| all: $(SNAME) $(DNAME)  | all: $(SNAME) $(DNAME)  | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								src/cw/cfg.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/cw/cfg.c
									
									
									
									
									
								
							| @ -335,13 +335,15 @@ int cw_cfg_read_from_file(FILE * f, cw_Cfg_t * cfg) | |||||||
| 	p.f=f; | 	p.f=f; | ||||||
| 	 | 	 | ||||||
| 	int rc; | 	int rc; | ||||||
|  | 	int errs=0; | ||||||
|  |  | ||||||
| 	 | 	 | ||||||
| 	do { | 	do { | ||||||
|  |  | ||||||
| 		rc = cw_cfg_read_line(f,&p,key,val); | 		rc = cw_cfg_read_line(f,&p,key,val); | ||||||
| 		if (rc==-1){ | 		if (rc==-1){ | ||||||
| 			fprintf(stderr,"Error: %s",p.error); | 			fprintf(stderr,"Error: %s\n",p.error); | ||||||
|  | 			errs++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -354,15 +356,17 @@ int cw_cfg_read_from_file(FILE * f, cw_Cfg_t * cfg) | |||||||
|  |  | ||||||
| 	}while(rc==0); | 	}while(rc==0); | ||||||
| 	 | 	 | ||||||
| 	return 0; | 	return errs; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| int cw_cfg_load(const char *filename,cw_Cfg_t * cfg) | int cw_cfg_load(const char *filename,cw_Cfg_t * cfg) | ||||||
| { | { | ||||||
|  | 	int errs; | ||||||
| 	FILE *f = fopen(filename,"rb"); | 	FILE *f = fopen(filename,"rb"); | ||||||
| 	if (!f) | 	if (!f) | ||||||
| 		return errno; | 		return errno; | ||||||
| 	cw_cfg_read_from_file(f,cfg); | 	errs = cw_cfg_read_from_file(f,cfg); | ||||||
| 	return 0; | 	fclose(f); | ||||||
|  | 	return errs; | ||||||
| } | } | ||||||
|  | |||||||
| @ -30,6 +30,8 @@ DNAME		:= $(LIBARCHDIR)/mod_capwap.so | |||||||
|  |  | ||||||
| CFLAGS+=-fPIC | CFLAGS+=-fPIC | ||||||
| CFLAGS+= -I ../../ -I../ -I../../include -I../../../include  | CFLAGS+= -I ../../ -I../ -I../../include -I../../../include  | ||||||
|  | CFLAGS+= -DUSE_OPENSSL | ||||||
|  |  | ||||||
| CFLAGS+=$(INC2) | CFLAGS+=$(INC2) | ||||||
|  |  | ||||||
| all: $(SNAME) $(DNAME)  | all: $(SNAME) $(DNAME)  | ||||||
|  | |||||||
| @ -45,7 +45,8 @@ SNAME		:= $(LIBARCHDIR)/libmod_cisco.a | |||||||
| DNAME		:= $(LIBARCHDIR)/mod_cisco.so | DNAME		:= $(LIBARCHDIR)/mod_cisco.so | ||||||
|  |  | ||||||
| CFLAGS+=-fPIC | CFLAGS+=-fPIC | ||||||
| CFLAGS+= -I ../../ -I../ -I../../include -I../../../include | CFLAGS+= -I ../../ -I../ -I../../include -I../../../include -I/usr/local/include | ||||||
|  | CFLAGS+= -DUSE_OPENSSL | ||||||
|  |  | ||||||
| all: $(SNAME) $(DNAME)  | all: $(SNAME) $(DNAME)  | ||||||
| static: $(SNAME) | static: $(SNAME) | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| #include <confuse.h> |  | ||||||
|  |  | ||||||
| #include "cw/cw.h" | #include "cw/cw.h" | ||||||
| #include "cw/mod.h" | #include "cw/mod.h" | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	