docs: document semaphore endpoint layouts
This commit is contained in:
65
src/sema.c
65
src/sema.c
@@ -171,8 +171,36 @@ int handle_func_0x20(CONNECTION *c, uint8 *p, int ufunc, uint8 *responsedata)
|
||||
{
|
||||
int result = -0xfb; /* unknown request */
|
||||
XDPRINTF((3, 0, "0x20 call ufunc=0x%x", ufunc));
|
||||
/*
|
||||
* Direct NCP 0x2222/32 Semaphore group. nwconn.c forwards this
|
||||
* group unchanged: requestdata[0] is SubFunctionCode and p points
|
||||
* at requestdata[1], the subfunction payload.
|
||||
*
|
||||
* The uploaded NDK/Core Protocols PDF and WebSDK list the old
|
||||
* NetWare 2.x/3.x-compatible semaphore subfunctions as SDK
|
||||
* 32/00 through 32/04. The newer SDK 111 semaphore variants have
|
||||
* the same semantic operations but are not routed here.
|
||||
*
|
||||
* Note the current wire-order compatibility detail before changing
|
||||
* this code: the PDF tables label SemaphoreHandle as long Lo-Hi,
|
||||
* while this handler currently reads and writes handles with the
|
||||
* big-endian helpers GET_BE32()/U32_TO_BE32(). TimeOut remains
|
||||
* documented and parsed Hi-Lo with GET_BE16().
|
||||
*/
|
||||
switch (ufunc) {
|
||||
case 0x0 : { /* open semaphore */
|
||||
/*
|
||||
* SDK 32/00 / wire subfunction 0x00 Open Semaphore
|
||||
* (old).
|
||||
* Request payload after SubFunctionCode:
|
||||
* byte InitialSemaphoreValue
|
||||
* byte SemaphoreNameLen
|
||||
* byte SemaphoreName[SemaphoreNameLen]
|
||||
* Reply data:
|
||||
* dword SemaphoreHandle (currently emitted with
|
||||
* U32_TO_BE32(), see group note above)
|
||||
* byte SemaphoreOpenCount
|
||||
*/
|
||||
int value = *p;
|
||||
int namlen = *(p+1);
|
||||
uint8 *name = (p+2);
|
||||
@@ -204,6 +232,16 @@ int handle_func_0x20(CONNECTION *c, uint8 *p, int ufunc, uint8 *responsedata)
|
||||
break;
|
||||
|
||||
case 0x1 : { /* examine semaphore */
|
||||
/*
|
||||
* SDK 32/01 / wire subfunction 0x01 Examine Semaphore
|
||||
* (old).
|
||||
* Request payload after SubFunctionCode:
|
||||
* dword SemaphoreHandle (currently parsed with
|
||||
* GET_BE32(), see group note above)
|
||||
* Reply data:
|
||||
* byte SemaphoreValue
|
||||
* byte SemaphoreOpenCount
|
||||
*/
|
||||
int handle = GET_BE32(p);
|
||||
struct XDATA {
|
||||
char value;
|
||||
@@ -224,6 +262,17 @@ int handle_func_0x20(CONNECTION *c, uint8 *p, int ufunc, uint8 *responsedata)
|
||||
|
||||
|
||||
case 0x2 : { /* wait on semaphore */
|
||||
/*
|
||||
* SDK 32/02 / wire subfunction 0x02 Wait On Semaphore
|
||||
* (old).
|
||||
* Request payload after SubFunctionCode:
|
||||
* dword SemaphoreHandle (currently parsed with
|
||||
* GET_BE32(), see group note above)
|
||||
* word SemaphoreTimeOut (Hi-Lo)
|
||||
* Reply: no data. Completion reports success, timeout,
|
||||
* or lock error. The simple local emulator does not
|
||||
* sleep; unavailable semaphores return timeout at once.
|
||||
*/
|
||||
int handle = GET_BE32(p);
|
||||
int timeout = GET_BE16(p+4);
|
||||
result=wait_sema(handle, timeout);
|
||||
@@ -233,6 +282,14 @@ int handle_func_0x20(CONNECTION *c, uint8 *p, int ufunc, uint8 *responsedata)
|
||||
break;
|
||||
|
||||
case 0x3 : { /* signal sema */
|
||||
/*
|
||||
* SDK 32/03 / wire subfunction 0x03 Signal Semaphore
|
||||
* (old).
|
||||
* Request payload after SubFunctionCode:
|
||||
* dword SemaphoreHandle (currently parsed with
|
||||
* GET_BE32(), see group note above)
|
||||
* Reply: no data.
|
||||
*/
|
||||
int handle = GET_BE32(p);
|
||||
result=signal_sema(handle);
|
||||
XDPRINTF((2, 0, "signal_sem:%d, result=%d",
|
||||
@@ -242,6 +299,14 @@ int handle_func_0x20(CONNECTION *c, uint8 *p, int ufunc, uint8 *responsedata)
|
||||
|
||||
|
||||
case 0x4 : { /* close semaphore */
|
||||
/*
|
||||
* SDK 32/04 / wire subfunction 0x04 Close Semaphore
|
||||
* (old).
|
||||
* Request payload after SubFunctionCode:
|
||||
* dword SemaphoreHandle (currently parsed with
|
||||
* GET_BE32(), see group note above)
|
||||
* Reply: no data.
|
||||
*/
|
||||
int handle = GET_BE32(p);
|
||||
result=close_conn_sema(c, handle);
|
||||
if (!result)
|
||||
|
||||
Reference in New Issue
Block a user