- Added asynchronous IO code from ANSTO
- Added new ACT protocol - Extended sicshdbadapter to cover counters and status to put the status into Hipadaba - Fixes to napi5.c - Exe now supports hdbrun which allows to write output for a buffer into hdb node.
This commit is contained in:
43
protocol.c
43
protocol.c
@ -21,8 +21,8 @@
|
||||
#define MAXMSG 1024
|
||||
#define INIT_STR_SIZE 256
|
||||
#define STR_RESIZE_LENGTH 256
|
||||
#define NUMPROS 5
|
||||
#define PROLISTLEN 6
|
||||
#define NUMPROS 6
|
||||
#define PROLISTLEN 7
|
||||
typedef struct __Protocol {
|
||||
pObjectDescriptor pDes; /* required as first field */
|
||||
char *name; /* protocol handler name */
|
||||
@ -106,6 +106,7 @@ pProtocol CreateProtocol(void)
|
||||
"withcode",
|
||||
"sycamore",
|
||||
"json",
|
||||
"act",
|
||||
NULL
|
||||
};
|
||||
pProtocol pNew = NULL;
|
||||
@ -217,7 +218,16 @@ int InstallProtocol(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
void MakeProtocol(SicsInterp *pSics){
|
||||
pProtocol pNew = NULL;
|
||||
pNew = CreateProtocol();
|
||||
if(NULL!= pNew)
|
||||
{
|
||||
AddCommand(pSics,"Protocol",ProtocolAction,DeleteProtocol,pNew);
|
||||
AddCommand(pSics,"contextdo",ContextDo,NULL,NULL);
|
||||
}
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int ProtocolOptions(SConnection* pCon, pProtocol pPro)
|
||||
{
|
||||
@ -281,6 +291,9 @@ static int ProtocolSet(SConnection* pCon, Protocol* pPro, char *pProName)
|
||||
case 4: /* json */
|
||||
SCSetWriteFunc(pCon,SCWriteJSON_String);
|
||||
break;
|
||||
case 5:
|
||||
SCSetWriteFunc(pCon,SCACTWrite);
|
||||
break;
|
||||
case 0: /* default = psi_sics */
|
||||
default:
|
||||
SCSetWriteFunc(pCon,pPro->defaultWriter);
|
||||
@ -327,6 +340,7 @@ int ProtocolGet(SConnection* pCon, void* pData, char *pProName, int len)
|
||||
case 2: /* outcodes */
|
||||
case 3: /* sycamore */
|
||||
case 4: /* json */
|
||||
case 5: /* act */
|
||||
pProName = pPro->pProList[Index];
|
||||
return 1;
|
||||
break;
|
||||
@ -785,3 +799,26 @@ int GetProtocolID(SConnection* pCon)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
writeFunc GetProtocolWriteFunc(SConnection *pCon){
|
||||
if(pCon != NULL){
|
||||
switch(pCon->iProtocolID){
|
||||
case 2: /* outcodes */
|
||||
return SCWriteWithOutcode;
|
||||
break;
|
||||
case 3: /* sycamore */
|
||||
return SCWriteSycamore;
|
||||
break;
|
||||
case 4: /* json */
|
||||
return SCWriteJSON_String;
|
||||
break;
|
||||
case 5:
|
||||
return SCACTWrite;
|
||||
break;
|
||||
default:
|
||||
return SCNormalWrite;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SCNormalWrite;
|
||||
}
|
||||
|
Reference in New Issue
Block a user