Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
f4f310cf
Commit
f4f310cf
authored
Nov 02, 2016
by
Alexander Alashkin
Committed by
Cesanta Bot
Nov 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add WinCE example, update Mongoose for WinCE6.0
PUBLISHED_FROM=2a76ccddb62b63caeaca3785a07d7d0b94125eaf
parent
0798b724
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
413 additions
and
4 deletions
+413
-4
Makefile
examples/Makefile
+1
-1
http_server.cpp
examples/WinCE/http_server/http_server.cpp
+60
-0
http_server.vcproj
examples/WinCE/http_server/http_server.vcproj
+269
-0
stdafx.cpp
examples/WinCE/http_server/stdafx.cpp
+8
-0
stdafx.h
examples/WinCE/http_server/stdafx.h
+56
-0
mongoose.c
mongoose.c
+1
-1
mongoose.h
mongoose.h
+18
-2
No files found.
examples/Makefile
View file @
f4f310cf
...
...
@@ -3,7 +3,7 @@
# `wildcard ./*/` works in both linux and linux/wine, while `wildcard */` enumerates nothing under wine
SUBDIRS
=
$
(
sort
$
(
dir
$
(
wildcard ./
*
/
)))
SUBDIRS
:=
$
(
filter-out ./ ./CC3200/ ./ESP8266_RTOS/ ./MSP432/ ./NXP_LPC4088/ ./NXP_K64/ ./PIC32/ ./STM32F4_CC3100/ ./mbed/ ./nRF51/ ./nRF52/,
$(SUBDIRS)
)
SUBDIRS
:=
$
(
filter-out ./ ./CC3200/ ./ESP8266_RTOS/ ./MSP432/ ./NXP_LPC4088/ ./NXP_K64/ ./PIC32/ ./STM32F4_CC3100/ ./mbed/ ./nRF51/ ./nRF52/
./WinCE/
,
$(SUBDIRS)
)
ifeq
($(OS),
Windows_NT)
SUBDIRS
:=
$
(
filter-out ./netcat/ ./raspberry_pi_mjpeg_led/ ./captive_dns_server/,
$(SUBDIRS)
)
...
...
examples/WinCE/http_server/http_server.cpp
0 → 100644
View file @
f4f310cf
#include "stdafx.h"
#include "mongoose.h"
static
const
char
*
s_http_port
=
"8000"
;
static
struct
mg_serve_http_opts
s_http_server_opts
;
void
ev_handler
(
struct
mg_connection
*
nc
,
int
ev
,
void
*
ev_data
)
{
switch
(
ev
)
{
case
MG_EV_ACCEPT
:
{
char
addr
[
32
];
mg_sock_addr_to_str
(
&
nc
->
sa
,
addr
,
sizeof
(
addr
),
MG_SOCK_STRINGIFY_IP
|
MG_SOCK_STRINGIFY_PORT
);
printf
(
"%p: Connection from %s
\r\n
"
,
nc
,
addr
);
break
;
}
case
MG_EV_HTTP_REQUEST
:
{
struct
http_message
*
hm
=
(
struct
http_message
*
)
ev_data
;
char
addr
[
32
];
mg_sock_addr_to_str
(
&
nc
->
sa
,
addr
,
sizeof
(
addr
),
MG_SOCK_STRINGIFY_IP
|
MG_SOCK_STRINGIFY_PORT
);
printf
(
"%p: %.*s %.*s
\r\n
"
,
nc
,
(
int
)
hm
->
method
.
len
,
hm
->
method
.
p
,
(
int
)
hm
->
uri
.
len
,
hm
->
uri
.
p
);
mg_send_response_line
(
nc
,
200
,
"Content-Type: text/html
\r\n
"
"Connection: close"
);
mg_printf
(
nc
,
"
\r\n
<h1>Hello, %s!</h1>
\r\n
"
"You asked for %.*s
\r\n
"
,
addr
,
(
int
)
hm
->
uri
.
len
,
hm
->
uri
.
p
);
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
break
;
}
case
MG_EV_CLOSE
:
{
printf
(
"%p: Connection closed
\r
4
\n
"
,
nc
);
break
;
}
}
}
int
_tmain
(
int
argc
,
_TCHAR
*
argv
[])
{
struct
mg_mgr
mgr
;
struct
mg_connection
*
nc
;
mg_mgr_init
(
&
mgr
,
NULL
);
printf
(
"Starting web server on port %s
\n
"
,
s_http_port
);
nc
=
mg_bind
(
&
mgr
,
s_http_port
,
ev_handler
);
if
(
nc
==
NULL
)
{
printf
(
"Failed to create listener
\n
"
);
return
1
;
}
mg_set_protocol_http_websocket
(
nc
);
for
(;;)
{
mg_mgr_poll
(
&
mgr
,
1000
);
}
mg_mgr_free
(
&
mgr
);
return
0
;
}
examples/WinCE/http_server/http_server.vcproj
0 → 100644
View file @
f4f310cf
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"http_server"
ProjectGUID=
"{10156103-D5BC-45B9-B0BF-332276D7BB99}"
RootNamespace=
"http_server"
Keyword=
"Win32Proj"
TargetFrameworkVersion=
"196613"
>
<Platforms>
<Platform
Name=
"Windows Mobile 6 Professional SDK (ARMV4I)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory=
"$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory=
"$(PlatformName)\$(ConfigurationName)"
ConfigurationType=
"1"
CharacterSet=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
ExecutionBucket=
"7"
Optimization=
"0"
AdditionalIncludeDirectories=
"./../.."
PreprocessorDefinitions=
"_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
MinimalRebuild=
"true"
RuntimeLibrary=
"1"
UsePrecompiledHeader=
"2"
WarningLevel=
"3"
DebugInformationFormat=
"3"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
PreprocessorDefinitions=
"_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture=
"1033"
AdditionalIncludeDirectories=
"$(IntDir)"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
AdditionalOptions=
" /subsystem:windowsce,5.02"
OutputFile=
"$(OutDir)/http_server.exe"
LinkIncremental=
"2"
DelayLoadDLLs=
"$(NOINHERIT)"
GenerateDebugInformation=
"true"
ProgramDatabaseFile=
"$(OutDir)/http_server.pdb"
SubSystem=
"0"
StackReserveSize=
"65536"
StackCommitSize=
"4096"
EntryPointSymbol=
"mainWCRTStartup"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCCodeSignTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty=
"-1"
RemoteDirectory=
""
RegisterOutput=
"0"
AdditionalFiles=
""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name=
"Release|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory=
"$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory=
"$(PlatformName)\$(ConfigurationName)"
ConfigurationType=
"1"
CharacterSet=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
ExecutionBucket=
"7"
Optimization=
"2"
FavorSizeOrSpeed=
"2"
PreprocessorDefinitions=
"NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
RuntimeLibrary=
"0"
UsePrecompiledHeader=
"2"
WarningLevel=
"3"
DebugInformationFormat=
"3"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
PreprocessorDefinitions=
"NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture=
"1033"
AdditionalIncludeDirectories=
"$(IntDir)"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
AdditionalOptions=
" /subsystem:windowsce,5.02"
OutputFile=
"$(OutDir)/http_server.exe"
LinkIncremental=
"1"
DelayLoadDLLs=
"$(NOINHERIT)"
GenerateDebugInformation=
"true"
ProgramDatabaseFile=
"$(OutDir)/http_server.pdb"
SubSystem=
"0"
StackReserveSize=
"65536"
StackCommitSize=
"4096"
OptimizeReferences=
"2"
EnableCOMDATFolding=
"2"
EntryPointSymbol=
"mainWCRTStartup"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCCodeSignTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty=
"-1"
RemoteDirectory=
""
RegisterOutput=
"0"
AdditionalFiles=
""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Source Files"
Filter=
"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=
".\http_server.cpp"
>
</File>
<File
RelativePath=
".\stdafx.cpp"
>
<FileConfiguration
Name=
"Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"1"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
".\stdafx.h"
>
</File>
</Filter>
<Filter
Name=
"Resource Files"
Filter=
"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier=
"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name=
"Mongoose"
>
<File
RelativePath=
"..\..\mongoose.c"
>
<FileConfiguration
Name=
"Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\..\mongoose.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
examples/WinCE/http_server/stdafx.cpp
0 → 100644
View file @
f4f310cf
// stdafx.cpp : source file that includes just the standard includes
// http_server.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
examples/WinCE/http_server/stdafx.h
0 → 100644
View file @
f4f310cf
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#pragma comment(linker, "/nodefaultlib:libc.lib")
#pragma comment(linker, "/nodefaultlib:libcd.lib")
// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted
#define WINVER _WIN32_WCE
#include <ceconfig.h>
#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
#define SHELL_AYGSHELL
#endif
#ifdef _CE_DCOM
#define _ATL_APARTMENT_THREADED
#endif
#include <windows.h>
#include <aygshell.h>
#pragma comment(lib, "aygshell.lib")
#include <stdio.h>
#include <tchar.h>
#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
#ifndef _DEVICE_RESOLUTION_AWARE
#define _DEVICE_RESOLUTION_AWARE
#endif
#endif
#ifdef _DEVICE_RESOLUTION_AWARE
#include "DeviceResolutionAware.h"
#endif
#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) )
#pragma comment(lib, "ccrtrtti.lib")
#ifdef _X86_
#if defined(_DEBUG)
#pragma comment(lib, "libcmtx86d.lib")
#else
#pragma comment(lib, "libcmtx86.lib")
#endif
#endif
#endif
#include <altcecrt.h>
// TODO: reference additional headers your program requires here
mongoose.c
View file @
f4f310cf
...
...
@@ -3070,7 +3070,7 @@ static sock_t mg_open_listening_socket(union socket_address *sa, int type,
if
((
sock
=
socket
(
sa
->
sa
.
sa_family
,
type
,
proto
))
!=
INVALID_SOCKET
&&
#if !MG_LWIP
/* LWIP doesn't support either */
#if defined(_WIN32) && defined(SO_EXCLUSIVEADDRUSE)
#if defined(_WIN32) && defined(SO_EXCLUSIVEADDRUSE)
&& !defined(WINCE)
/* "Using SO_REUSEADDR and SO_EXCLUSIVEADDRUSE" http://goo.gl/RmrFTm */
!
setsockopt
(
sock
,
SOL_SOCKET
,
SO_EXCLUSIVEADDRUSE
,
(
void
*
)
&
on
,
sizeof
(
on
))
&&
...
...
mongoose.h
View file @
f4f310cf
...
...
@@ -1170,12 +1170,10 @@ typedef uint32_t in_addr_t;
#define CS_ENABLE_STDIO 1
#endif
typedef
unsigned
int
*
uintptr_t
;
#define abort() DebugBreak();
#ifndef BUFSIZ
#define BUFSIZ 4096
#define ENOMEM ERROR_NOT_ENOUGH_MEMORY
#endif
/*
* Explicitly disabling MG_ENABLE_THREADS for WinCE
...
...
@@ -1199,8 +1197,26 @@ typedef struct _stati64 {
uint32_t
st_mode
;
}
cs_stat_t
;
/*
* WinCE 6.0 has a lot of useful definitions in ATL (not windows.h) headers
* use #ifdefs to avoid conflicts
*/
#ifndef ENOENT
#define ENOENT ERROR_PATH_NOT_FOUND
#endif
#ifndef EACCES
#define EACCES ERROR_ACCESS_DENIED
#endif
#ifndef ENOMEM
#define ENOMEM ERROR_NOT_ENOUGH_MEMORY
#endif
#ifndef _UINTPTR_T_DEFINED
typedef
unsigned
int
*
uintptr_t
;
#endif
#define _S_IFREG 2
#define _S_IFDIR 4
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment