Skip to content

Commit

Permalink
Zowe Suite v1.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Jan 29, 2021
2 parents f9473f4 + 1d0af70 commit e82f4c6
Show file tree
Hide file tree
Showing 15 changed files with 2,431 additions and 44 deletions.
42 changes: 41 additions & 1 deletion c/bpxskt.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#ifdef USE_RS_SSL
#include "rs_ssl.h"
#endif
#ifdef USE_ZOWE_TLS
#include "tls.h"
#endif

#ifdef _LP64
#pragma linkage(BPX4SOC,OS)
Expand Down Expand Up @@ -998,6 +1001,20 @@ int socketRead(Socket *socket, char *buffer, int desiredBytes,
}
}
#endif
#ifdef USE_ZOWE_TLS
if (NULL != socket->tlsSocket) {
int bytesRead = 0;
status = tlsRead(socket->tlsSocket, buffer, desiredBytes, &bytesRead);
if (0 != status) {
if (socketTrace){
printf("socketRead: tlsRead failed with status: %d (%s)\n", status, tlsStrError(status));
}
return -1;
} else {
return bytesRead;
}
}
#endif

#ifndef _LP64
reasonCodePtr = (int*) (0x80000000 | ((int)reasonCode));
Expand Down Expand Up @@ -1046,6 +1063,20 @@ int socketWrite(Socket *socket, const char *buffer, int desiredBytes,
}
}
#endif
#ifdef USE_ZOWE_TLS
if (NULL != socket->tlsSocket) {
int bytesWritten = 0;
status = tlsWrite(socket->tlsSocket, buffer, desiredBytes, &bytesWritten);
if (0 != status) {
if (socketTrace){
printf("socketWrite: tlsWrite failed with status: %d (%s)\n", status, tlsStrError(status));
}
return -1;
} else {
return bytesWritten;
}
}
#endif // USE_ZOWE_TLS

#ifndef _LP64
reasonCodePtr = (int*) (0x80000000 | ((int)reasonCode));
Expand Down Expand Up @@ -1595,7 +1626,16 @@ int socketClose(Socket *socket, int *returnCode, int *reasonCode){
returnValue = rs_ssl_releaseConnection(socket->sslHandle);
return returnValue;
}
#endif
#endif // USE_RS_SSL
#ifdef USE_ZOWE_TLS
if (!socket->isServer && socket->tlsSocket) {
int rc = tlsSocketClose(socket->tlsSocket);
if (rc != 0 && socketTrace) {
printf("Error closing tls socket rc=%d (%s)\n", rc, tlsStrError(rc));
}
socket->tlsSocket = NULL;
}
#endif // USE_ZOWE_TLS

int *reasonCodePtr;
int status;
Expand Down
17 changes: 12 additions & 5 deletions c/dataservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "le.h"
#include "json.h"
#include "httpserver.h"
#include "storage.h"
#include "dataservice.h"

#define SERVICE_TYPE_SERVICE 1
Expand Down Expand Up @@ -142,14 +143,15 @@ static void *lookupDLLEntryPoint(char *libraryName, char *functionName){
}

static DataService *makeDataService(WebPlugin *plugin, JsonObject *serviceJsonObject, char *subURI, InternalAPIMap *namedAPIMap,
unsigned int *idMultiplier, int pluginLogLevel) {
unsigned int *idMultiplier, int pluginLogLevel, Storage *storage) {
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_DEBUG, "%s begin data service:\n", __FUNCTION__);
DataService *service = (DataService*) safeMalloc(sizeof (DataService), "DataService");
memset(service, 0, sizeof (DataService));
service->plugin = plugin;
service->serviceDefinition = serviceJsonObject;
service->pattern = jsonObjectGetString(serviceJsonObject, "pattern");
service->subURI = subURI;
service->storage = storage;
if (subURI) { /* group member */
service->name = jsonObjectGetString(serviceJsonObject, "subserviceName");
} else {
Expand Down Expand Up @@ -258,8 +260,8 @@ static bool isValidServiceDef(JsonObject *serviceDef) {
return true;
}

WebPlugin *makeWebPlugin(char *pluginLocation, JsonObject *pluginDefintion, InternalAPIMap *internalAPIMap,
unsigned int *idMultiplier, int pluginLogLevel) {
WebPlugin *makeWebPlugin2(char *pluginLocation, JsonObject *pluginDefintion, InternalAPIMap *internalAPIMap,
unsigned int *idMultiplier, int pluginLogLevel, Storage *storage) {
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);
WebPlugin *plugin = (WebPlugin*)safeMalloc(sizeof(WebPlugin),"WebPlugin");
memset(plugin, 0, sizeof (WebPlugin));
Expand Down Expand Up @@ -310,15 +312,15 @@ WebPlugin *makeWebPlugin(char *pluginLocation, JsonObject *pluginDefintion, Inte

if (!type || !strcmp(type, "service")) {
plugin->dataServices[k++] = makeDataService(plugin, jsonArrayGetObject(dataServices, i), NULL, internalAPIMap,
idMultiplier, pluginLogLevel);
idMultiplier, pluginLogLevel, storage);
(*idMultiplier++);
} else if (!strcmp(type, "group")) {
char *subURI = jsonObjectGetString(serviceDef, "name");
JsonArray* group = jsonObjectGetArray(serviceDef, "subservices");
if (group) {
for (int j = 0; j < jsonArrayGetCount(group); j++) {
plugin->dataServices[k++] = makeDataService(plugin, jsonArrayGetObject(group, j), subURI, internalAPIMap,
idMultiplier, pluginLogLevel);
idMultiplier, pluginLogLevel, storage);
(*idMultiplier++);
}
}
Expand All @@ -331,6 +333,11 @@ WebPlugin *makeWebPlugin(char *pluginLocation, JsonObject *pluginDefintion, Inte
return plugin;
}

WebPlugin *makeWebPlugin(char *pluginLocation, JsonObject *pluginDefintion, InternalAPIMap *internalAPIMap,
unsigned int *idMultiplier, int pluginLogLevel) {
return makeWebPlugin2(pluginLocation, pluginDefintion, internalAPIMap, idMultiplier, pluginLogLevel, NULL);
}

HttpService *makeHttpDataService(DataService *dataService, HttpServer *server) {
char urlMask[512] = {0};
int result;
Expand Down
Loading

0 comments on commit e82f4c6

Please sign in to comment.