Code/CFLite/CFNetwork: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
Download the [http://kjams.com/cflite/downloads/cfnetwork.zip CFNetwork] framework. | Download the [http://kjams.com/cflite/downloads/cfnetwork.zip CFNetwork] framework. | ||
= OpenCFLite project and file changes = | |||
* CFNetTest\CFTest\win_vs\pre_build.bat; Change VS vars path to call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" | |||
* CFTest.vcproj - change QuickTime libraries path in Linker to $(SolutionDir)..\..\kJams\External\QuickTime SDK\Libraries | |||
* Add explicit direction __WIN32__ to PreprocessorDefinitions so that VS2008 properly reflects disabled code | |||
* mDNSResponder support (dns-sd) | |||
** Add mDNSResponder folder to the include path to OpenCFLite project; | |||
** Add lib file to linker configuration $(ProjectDir)..\..\mDNSResponder\lib\dnssd.lib | |||
=== CFNetwork file references === | |||
** CFNetwork\Host\CFHost.c | |||
** CFNetwork\HTTP\CFHTTPAuthentication.c | |||
** CFNetwork\HTTP\CFHTTPConnection.c | |||
** CFNetwork\HTTP\CFHTTPFilter.c | |||
** CFNetwork\HTTP\CFHTTPMessage.c | |||
** CFNetwork\HTTP\CFHTTPServer.c | |||
** CFNetwork\HTTP\CFHTTPStream.c | |||
** CFNetwork\SharedCode\CFNetConnection.c | |||
** CFNetwork\NetServices\CFNetServiceBrowser.c | |||
** CFNetwork\NetServices\CFNetServiceMonitor.c | |||
** CFNetwork\NetServices\CFNetServices.c | |||
** CFNetwork\CFNetwork.c | |||
** CFNetwork\CFNetworkInternal.h | |||
** CFNetwork\SharedCode\CFNetworkSchedule.c | |||
** CFNetwork\SharedCode\CFNetworkThreadSupport.c | |||
** CFNetwork\SharedCode\CFServer.c | |||
** CFNetwork\Stream\CFSocketStream.c | |||
** CFNetwork\Stream\CFSocketStreamImpl.h | |||
** CFNetwork\Proxies\ProxySupport.c | |||
** CFNetwork\HTTP\CFHTTPConnectionInternal.h | |||
** CFNetwork\HTTP\CFHTTPInternal.h | |||
** CFNetwork\HTTP\NTLM\ntlmBlobPriv.cpp | |||
** CFNetwork\HTTP\NTLM\NtlmGenerator.cpp | |||
** CFNetwork\NetDiagnostics\CFNetDiagnosticsInternal.h | |||
** CFNetwork\NetDiagnostics\CFNetDiagnosticsProtocol.h | |||
** CFNetwork\include\CFNetwork\CFHTTPConnectionPriv.h | |||
** CFNetwork\include\CFNetwork\CFHTTPAuthentication.h | |||
** CFNetwork\include\CFNetwork\CFHTTPMessage.h | |||
** CFNetwork\include\CFNetwork\CFHTTPMessagePriv.h | |||
** CFNetwork\include\CFNetwork\CFHTTPServerPriv.h | |||
** CFNetwork\include\CFNetwork\CFHTTPStream.h | |||
** CFNetwork\include\CFNetwork\CFHTTPStreamPriv.h | |||
** CFNetwork\include\CFNetwork\CFNetDiagnostics.h | |||
** CFNetwork\include\CFNetwork\CFNetDiagnosticsPriv.h | |||
** CFNetwork\include\CFNetwork\cfnetservices.h | |||
** CFNetwork\include\CFNetwork\CFNetServicesPriv.h | |||
** CFNetwork\include\CFNetwork\CFNetwork.h | |||
** CFNetwork\include\CFNetwork\CFNetworkDefs.h | |||
** CFNetwork\include\CFNetwork\CFNetworkDefs.h | |||
** CFNetwork\include\CFNetwork\CFNetworkPriv.h | |||
** CFNetwork\include\CFNetwork\CFSocketStream.h | |||
** CFNetwork\include\CFNetwork\CFSocketStreamPriv.h | |||
=== File modifications === | |||
* CFBase.h - make typedef for Boolean type available to WINDOWS target | |||
** Line added to CFBase.h - "typedef unsigned char Boolean; | |||
* CFRuntime.c - Added two new functions for socket initialization (WinSock requires startup code) | |||
** Added __CFSocketInitialize | |||
** Added __CFSocketInitializeWinSock | |||
* Socket initialization is added to __CFInitialize | |||
** CFSocket ensures initialization on creation. However this is needed so that any other code could reference WinSock API (Ex: AddressLookup) | |||
* CFSocketStream.c - instead of the default need to use the code in CFNetwork (NOTE: This file needs to be references in includes) | |||
* CFUrlAccess.c - merge in new functionality from _CFUrlAccess.c available in CFNetwork distribution | |||
** Added _CFHTTPMessageSendRequest | |||
** Added _CFURLCreateDataAndPropertiesFromResource | |||
** Added _CFURLWriteDataAndPropertiesToResource | |||
** Added _CFURLDestroyResource | |||
* Add support for HTTP URL into the existing function CFURLCreateDataAndPropertiesFromResource | |||
* ForFoundationOnly.h - added HTTP cleanup routines | |||
= Porting CFNetwork to VS complier = | |||
First import thing to note is compiler differences on difference platforms - Visual Studio 2008 supports C90 standard. A newer complier was used to develop CFNetwork. Hence the most important differences: | |||
* All variable definitions must be placed at the beginning of each scope (otherwise it fails with "illegal type as an expression" errors) | |||
* C90 allows structure initialization only by compile time constants (no pointers or even constants pointers to constant data) | |||
* inline support - Visual studio uses keyword __inline (double underscore is required) | |||
* Visual Studio compiler does not allow double class storage specifier such as "static static int var" | |||
Revision as of 01:58, 15 March 2012
Home of future project.
Download the CFNetwork framework.
OpenCFLite project and file changes
- CFNetTest\CFTest\win_vs\pre_build.bat; Change VS vars path to call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat"
- CFTest.vcproj - change QuickTime libraries path in Linker to $(SolutionDir)..\..\kJams\External\QuickTime SDK\Libraries
- Add explicit direction __WIN32__ to PreprocessorDefinitions so that VS2008 properly reflects disabled code
- mDNSResponder support (dns-sd)
- Add mDNSResponder folder to the include path to OpenCFLite project;
- Add lib file to linker configuration $(ProjectDir)..\..\mDNSResponder\lib\dnssd.lib
CFNetwork file references
- CFNetwork\Host\CFHost.c
- CFNetwork\HTTP\CFHTTPAuthentication.c
- CFNetwork\HTTP\CFHTTPConnection.c
- CFNetwork\HTTP\CFHTTPFilter.c
- CFNetwork\HTTP\CFHTTPMessage.c
- CFNetwork\HTTP\CFHTTPServer.c
- CFNetwork\HTTP\CFHTTPStream.c
- CFNetwork\SharedCode\CFNetConnection.c
- CFNetwork\NetServices\CFNetServiceBrowser.c
- CFNetwork\NetServices\CFNetServiceMonitor.c
- CFNetwork\NetServices\CFNetServices.c
- CFNetwork\CFNetwork.c
- CFNetwork\CFNetworkInternal.h
- CFNetwork\SharedCode\CFNetworkSchedule.c
- CFNetwork\SharedCode\CFNetworkThreadSupport.c
- CFNetwork\SharedCode\CFServer.c
- CFNetwork\Stream\CFSocketStream.c
- CFNetwork\Stream\CFSocketStreamImpl.h
- CFNetwork\Proxies\ProxySupport.c
- CFNetwork\HTTP\CFHTTPConnectionInternal.h
- CFNetwork\HTTP\CFHTTPInternal.h
- CFNetwork\HTTP\NTLM\ntlmBlobPriv.cpp
- CFNetwork\HTTP\NTLM\NtlmGenerator.cpp
- CFNetwork\NetDiagnostics\CFNetDiagnosticsInternal.h
- CFNetwork\NetDiagnostics\CFNetDiagnosticsProtocol.h
- CFNetwork\include\CFNetwork\CFHTTPConnectionPriv.h
- CFNetwork\include\CFNetwork\CFHTTPAuthentication.h
- CFNetwork\include\CFNetwork\CFHTTPMessage.h
- CFNetwork\include\CFNetwork\CFHTTPMessagePriv.h
- CFNetwork\include\CFNetwork\CFHTTPServerPriv.h
- CFNetwork\include\CFNetwork\CFHTTPStream.h
- CFNetwork\include\CFNetwork\CFHTTPStreamPriv.h
- CFNetwork\include\CFNetwork\CFNetDiagnostics.h
- CFNetwork\include\CFNetwork\CFNetDiagnosticsPriv.h
- CFNetwork\include\CFNetwork\cfnetservices.h
- CFNetwork\include\CFNetwork\CFNetServicesPriv.h
- CFNetwork\include\CFNetwork\CFNetwork.h
- CFNetwork\include\CFNetwork\CFNetworkDefs.h
- CFNetwork\include\CFNetwork\CFNetworkDefs.h
- CFNetwork\include\CFNetwork\CFNetworkPriv.h
- CFNetwork\include\CFNetwork\CFSocketStream.h
- CFNetwork\include\CFNetwork\CFSocketStreamPriv.h
File modifications
- CFBase.h - make typedef for Boolean type available to WINDOWS target
- Line added to CFBase.h - "typedef unsigned char Boolean;
- CFRuntime.c - Added two new functions for socket initialization (WinSock requires startup code)
- Added __CFSocketInitialize
- Added __CFSocketInitializeWinSock
- Socket initialization is added to __CFInitialize
- CFSocket ensures initialization on creation. However this is needed so that any other code could reference WinSock API (Ex: AddressLookup)
- CFSocketStream.c - instead of the default need to use the code in CFNetwork (NOTE: This file needs to be references in includes)
- CFUrlAccess.c - merge in new functionality from _CFUrlAccess.c available in CFNetwork distribution
- Added _CFHTTPMessageSendRequest
- Added _CFURLCreateDataAndPropertiesFromResource
- Added _CFURLWriteDataAndPropertiesToResource
- Added _CFURLDestroyResource
- Add support for HTTP URL into the existing function CFURLCreateDataAndPropertiesFromResource
- ForFoundationOnly.h - added HTTP cleanup routines
Porting CFNetwork to VS complier
First import thing to note is compiler differences on difference platforms - Visual Studio 2008 supports C90 standard. A newer complier was used to develop CFNetwork. Hence the most important differences:
- All variable definitions must be placed at the beginning of each scope (otherwise it fails with "illegal type as an expression" errors)
- C90 allows structure initialization only by compile time constants (no pointers or even constants pointers to constant data)
- inline support - Visual studio uses keyword __inline (double underscore is required)
- Visual Studio compiler does not allow double class storage specifier such as "static static int var"