Skip to content

Commit

Permalink
winpr: stubbed pipe module, added some test stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Oct 7, 2012
1 parent 3d98273 commit 7891e0a
Show file tree
Hide file tree
Showing 33 changed files with 370 additions and 9 deletions.
4 changes: 0 additions & 4 deletions winpr/include/winpr/interlocked.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ WINPR_API LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination,

/* Doubly-Linked List */

#ifndef _WIN32

VOID InitializeListHead(PLIST_ENTRY ListHead);

BOOL IsListEmpty(const LIST_ENTRY* ListHead);
Expand All @@ -168,7 +166,5 @@ VOID AppendTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListToAppend);
VOID PushEntryList(PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry);
PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead);

#endif

#endif /* WINPR_INTERLOCKED_H */

33 changes: 33 additions & 0 deletions winpr/include/winpr/pipe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* WinPR: Windows Portable Runtime
* Pipe Functions
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef WINPR_PIPE_H
#define WINPR_PIPE_H

#include <winpr/winpr.h>
#include <winpr/error.h>
#include <winpr/wtypes.h>

#ifndef _WIN32

WINPR_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);

#endif

#endif /* WINPR_PIPE_H */
8 changes: 8 additions & 0 deletions winpr/libwinpr/asn1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ set(MODULE_PREFIX "WINPR_ASN1")
set(${MODULE_PREFIX}_SRCS
asn1.c)

if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
endif()

if(WITH_MONOLITHIC_BUILD)
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
else()
Expand All @@ -36,3 +40,7 @@ else()
endif()

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")

if(BUILD_TESTING)
add_subdirectory(test)
endif()
3 changes: 3 additions & 0 deletions winpr/libwinpr/asn1/module.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LIBRARY "libwinpr-asn1"
EXPORTS

2 changes: 2 additions & 0 deletions winpr/libwinpr/asn1/test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TestAsn1
TestAsn1.c
34 changes: 34 additions & 0 deletions winpr/libwinpr/asn1/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

set(MODULE_NAME "TestAsn1")
set(MODULE_PREFIX "TEST_ASN1")

set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)

set(${MODULE_PREFIX}_TESTS
TestAsn1Module.c
TestAsn1Encoder.c
TestAsn1Decoder.c
TestAsn1Encode.c
TestAsn1Decode.c
TestAsn1String.c
TestAsn1Integer.c
TestAsn1Compare.c
TestAsn1BerEnc.c
TestAsn1BerDec.c
TestAsn1DerEnc.c
TestAsn1DerDec.c)

create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})

add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

target_link_libraries(${MODULE_NAME} winpr-asn1)

foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
endforeach()

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1BerDec.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1BerDec(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1BerEnc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1BerEnc(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Compare.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Compare(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Decode.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Decode(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Decoder.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Decoder(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1DerDec.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1DerDec(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1DerEnc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1DerEnc(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Encode.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Encode(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Encoder.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Encoder(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Integer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Integer(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1Module.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1Module(int argc, char* argv[])
{
return 0;
}

11 changes: 11 additions & 0 deletions winpr/libwinpr/asn1/test/TestAsn1String.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/asn1.h>
#include <winpr/winpr.h>

int TestAsn1String(int argc, char* argv[])
{
return 0;
}

4 changes: 4 additions & 0 deletions winpr/libwinpr/handle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ set(${MODULE_PREFIX}_SRCS
handle.c
table.c)

if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
endif()

if(WITH_MONOLITHIC_BUILD)
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
else()
Expand Down
3 changes: 3 additions & 0 deletions winpr/libwinpr/handle/module.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LIBRARY "libwinpr-handle"
EXPORTS

3 changes: 0 additions & 3 deletions winpr/libwinpr/interlocked/interlocked.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG E
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff563802/
*/

#ifndef _WIN32

VOID InitializeListHead(PLIST_ENTRY ListHead)
{
ListHead->Flink = ListHead->Blink = ListHead;
Expand Down Expand Up @@ -395,4 +393,3 @@ PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead)
return FirstEntry;
}

#endif
10 changes: 10 additions & 0 deletions winpr/libwinpr/interlocked/module.def
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
LIBRARY "libwinpr-interlocked"
EXPORTS
InterlockedCompareExchange64 @1
InitializeListHead @2
IsListEmpty @3
RemoveEntryList @4
InsertHeadList @5
RemoveHeadList @6
InsertTailList @7
RemoveTailList @8
AppendTailList @9
PushEntryList @10
PopEntryList @11
2 changes: 1 addition & 1 deletion winpr/libwinpr/library/test/TestLibraryGetProcAddress.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
char* str;
int length;
LPTSTR BasePath;
HINSTANCE library;
//HINSTANCE library;
LPTSTR LibraryPath;

str = argv[1];
Expand Down
47 changes: 47 additions & 0 deletions winpr/libwinpr/pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# WinPR: Windows Portable Runtime
# libwinpr-pipe cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set(MODULE_NAME "winpr-pipe")
set(MODULE_PREFIX "WINPR_PIPE")

set(${MODULE_PREFIX}_SRCS
pipe.c)

if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
endif()

if(WITH_MONOLITHIC_BUILD)
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
else()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
endif()

set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")

if(WITH_MONOLITHIC_BUILD)

else()
target_link_libraries(${MODULE_NAME} winpr-crt)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")

if(BUILD_TESTING)
add_subdirectory(test)
endif()
9 changes: 9 additions & 0 deletions winpr/libwinpr/pipe/ModuleOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "2")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "namedpipe")
set(MINWIN_LONG_NAME "Named Pipe Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

3 changes: 3 additions & 0 deletions winpr/libwinpr/pipe/module.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LIBRARY "libwinpr-pipe"
EXPORTS

Loading

0 comments on commit 7891e0a

Please sign in to comment.