diff --git a/internal/ccsmp/ccsmp_container.go b/internal/ccsmp/ccsmp_container.go index fe2d33a..ac7434a 100644 --- a/internal/ccsmp/ccsmp_container.go +++ b/internal/ccsmp/ccsmp_container.go @@ -24,6 +24,7 @@ import ( ) /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include "solclient/solClient.h" diff --git a/internal/ccsmp/ccsmp_core.go b/internal/ccsmp/ccsmp_core.go index 7aa5e60..8d341cf 100644 --- a/internal/ccsmp/ccsmp_core.go +++ b/internal/ccsmp/ccsmp_core.go @@ -19,6 +19,7 @@ package ccsmp /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include @@ -52,6 +53,10 @@ import ( // Reexport of various CCSMP types +type SolClientOpaquePointerType = C.uintptr_t + +const SolClientOpaquePointerInvalidValue = SolClientOpaquePointerType(0) + // SolClientContextPt is assigned a value type SolClientContextPt = C.solClient_opaqueContext_pt @@ -250,7 +255,7 @@ type SolClientSession struct { // SetMessageCallback sets the message callback to use func (session *SolClientSession) SetMessageCallback(callback SolClientMessageCallback) error { - if session == nil || session.pointer == nil { + if session == nil || session.pointer == SolClientOpaquePointerInvalidValue { return fmt.Errorf("could not set message receive callback for nil session") } if callback == nil { @@ -263,7 +268,7 @@ func (session *SolClientSession) SetMessageCallback(callback SolClientMessageCal // SetReplyMessageCallback sets the message callback to use func (session *SolClientSession) SetReplyMessageCallback(callback SolClientReplyMessageCallback) error { - if session == nil || session.pointer == nil { + if session == nil || session.pointer == SolClientOpaquePointerInvalidValue { return fmt.Errorf("could not set message receive callback for nil session") } if callback == nil { @@ -276,7 +281,7 @@ func (session *SolClientSession) SetReplyMessageCallback(callback SolClientReply // SetEventCallback sets the event callback to use func (session *SolClientSession) SetEventCallback(callback SolClientSessionEventCallback) error { - if session == nil || session.pointer == nil { + if session == nil || session.pointer == SolClientOpaquePointerInvalidValue { return fmt.Errorf("could not set event callback for nil session") } if callback == nil { @@ -300,8 +305,7 @@ func SolClientInitialize(props []string) *SolClientErrorInfoWrapper { func SolClientContextCreate() (context *SolClientContext, err *SolClientErrorInfoWrapper) { var contextP SolClientContextPt solClientErrorInfo := handleCcsmpError(func() SolClientReturnCode { - var contextFuncInfo C.solClient_context_createFuncInfo_t - return C.solClient_context_create(C.SOLCLIENT_CONTEXT_PROPS_DEFAULT_WITH_CREATE_THREAD, &contextP, &contextFuncInfo, 24) + return C.SessionContextCreate(C.SOLCLIENT_CONTEXT_PROPS_DEFAULT_WITH_CREATE_THREAD, &contextP) }) if solClientErrorInfo != nil { return nil, solClientErrorInfo @@ -322,14 +326,10 @@ func (context *SolClientContext) SolClientSessionCreate(properties []string) (se sessionPropsP, sessionPropertiesFreeFunction := ToCArray(properties, true) defer sessionPropertiesFreeFunction() - var sessionFuncInfo C.solClient_session_createFuncInfo_t - sessionFuncInfo.rxMsgInfo.callback_p = (C.solClient_session_rxMsgCallbackFunc_t)(unsafe.Pointer(C.defaultMessageReceiveCallback)) - sessionFuncInfo.rxMsgInfo.user_p = nil - sessionFuncInfo.eventInfo.callback_p = (C.solClient_session_eventCallbackFunc_t)(unsafe.Pointer(C.eventCallback)) - sessionFuncInfo.eventInfo.user_p = nil - solClientErrorInfo := handleCcsmpError(func() SolClientReturnCode { - return C.solClient_session_create(sessionPropsP, context.pointer, &sessionP, &sessionFuncInfo, (C.size_t)(unsafe.Sizeof(sessionFuncInfo))) + return C.SessionCreate(sessionPropsP, + context.pointer, + &sessionP) }) if solClientErrorInfo != nil { return nil, solClientErrorInfo diff --git a/internal/ccsmp/ccsmp_endpoint_permissions.go b/internal/ccsmp/ccsmp_endpoint_permissions.go index 5a2f637..0fb925b 100644 --- a/internal/ccsmp/ccsmp_endpoint_permissions.go +++ b/internal/ccsmp/ccsmp_endpoint_permissions.go @@ -17,6 +17,7 @@ package ccsmp /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_endpoint_prop_generated.go b/internal/ccsmp/ccsmp_endpoint_prop_generated.go index 0689859..1bc3ffd 100644 --- a/internal/ccsmp/ccsmp_endpoint_prop_generated.go +++ b/internal/ccsmp/ccsmp_endpoint_prop_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_endpoint_prop_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_flow.go b/internal/ccsmp/ccsmp_flow.go index efa271c..b345b41 100644 --- a/internal/ccsmp/ccsmp_flow.go +++ b/internal/ccsmp/ccsmp_flow.go @@ -25,6 +25,7 @@ import ( ) /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include diff --git a/internal/ccsmp/ccsmp_flow_event_generated.go b/internal/ccsmp/ccsmp_flow_event_generated.go index 1abc3ed..9b83de6 100644 --- a/internal/ccsmp/ccsmp_flow_event_generated.go +++ b/internal/ccsmp/ccsmp_flow_event_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_flow_event_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_flow_prop_generated.go b/internal/ccsmp/ccsmp_flow_prop_generated.go index 6138c35..a4db657 100644 --- a/internal/ccsmp/ccsmp_flow_prop_generated.go +++ b/internal/ccsmp/ccsmp_flow_prop_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_flow_prop_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_global_prop_generated.go b/internal/ccsmp/ccsmp_global_prop_generated.go index f8180c4..ce71cff 100644 --- a/internal/ccsmp/ccsmp_global_prop_generated.go +++ b/internal/ccsmp/ccsmp_global_prop_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_global_prop_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_helper.c b/internal/ccsmp/ccsmp_helper.c index 431a093..78e737e 100644 --- a/internal/ccsmp/ccsmp_helper.c +++ b/internal/ccsmp/ccsmp_helper.c @@ -24,12 +24,17 @@ solClient_rxMsgCallback_returnCode_t messageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p); +solClient_rxMsgCallback_returnCode_t +defaultMessageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p); + solClient_rxMsgCallback_returnCode_t requestResponseReplyMessageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p); solClient_rxMsgCallback_returnCode_t flowMessageReceiveCallback(solClient_opaqueFlow_pt opaqueFlow_p, solClient_opaqueMsg_pt msg_p, void *user_p); +void eventCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_session_eventCallbackInfo_pt eventInfo_p, void *user_p); + void flowEventCallback(solClient_opaqueFlow_pt opaqueFlow_p, solClient_flow_eventCallbackInfo_pt eventInfo_p, void *user_p); solClient_returnCode_t @@ -53,6 +58,37 @@ solClientgo_msg_isRequestReponseMsg(solClient_opaqueMsg_pt msg_p, char **correla return SOLCLIENT_OK; } +solClient_returnCode_t +SessionCreate( solClient_propertyArray_pt sessionPropsP, + solClient_opaqueContext_pt contextP, + solClient_opaqueSession_pt *opaqueSession_p) +{ + /* allocate the session create struct */ + solClient_session_createFuncInfo_t sessionCreateFuncInfo; + sessionCreateFuncInfo.rxMsgInfo.callback_p = (solClient_session_rxMsgCallbackFunc_t)defaultMessageReceiveCallback; + sessionCreateFuncInfo.rxMsgInfo.user_p = NULL; + sessionCreateFuncInfo.eventInfo.callback_p = (solClient_session_eventCallbackFunc_t)eventCallback; + sessionCreateFuncInfo.eventInfo.user_p = NULL; + // allocate thse struct fields to NULL too + sessionCreateFuncInfo.rxInfo.user_p = NULL; + sessionCreateFuncInfo.rxInfo.callback_p = NULL; + + return solClient_session_create(sessionPropsP, contextP, opaqueSession_p, &sessionCreateFuncInfo, sizeof(sessionCreateFuncInfo)); +} + +solClient_returnCode_t +SessionContextCreate( solClient_propertyArray_pt contextPropsP, + solClient_opaqueContext_pt *contextP) +{ + /* allocate the session context create struct to NULL */ + solClient_context_createFuncInfo_t contextCreateFuncInfo; + contextCreateFuncInfo.regFdInfo.user_p = NULL; + contextCreateFuncInfo.regFdInfo.regFdFunc_p = NULL; + contextCreateFuncInfo.regFdInfo.unregFdFunc_p = NULL; + + return solClient_context_create(contextPropsP, contextP, &contextCreateFuncInfo, sizeof(contextCreateFuncInfo)); +} + solClient_returnCode_t SessionFlowCreate( solClient_opaqueSession_pt opaqueSession_p, solClient_propertyArray_pt flowPropsP, diff --git a/internal/ccsmp/ccsmp_helper.h b/internal/ccsmp/ccsmp_helper.h index 04f2d8e..d588914 100644 --- a/internal/ccsmp/ccsmp_helper.h +++ b/internal/ccsmp/ccsmp_helper.h @@ -44,6 +44,15 @@ typedef struct solClient_errorInfo_wrapper * operating systems are supported, this may need to change to a more complex * definition. */ +solClient_returnCode_t SessionCreate( + solClient_propertyArray_pt sessionPropsP, + solClient_opaqueContext_pt contextP, + solClient_opaqueSession_pt *opaqueSession_p); + +solClient_returnCode_t SessionContextCreate( + solClient_propertyArray_pt contextPropsP, + solClient_opaqueContext_pt *contextP); + solClient_returnCode_t SessionFlowCreate( solClient_opaqueSession_pt opaqueSession_p, solClient_propertyArray_pt flowPropsP, diff --git a/internal/ccsmp/ccsmp_log_level_generated.go b/internal/ccsmp/ccsmp_log_level_generated.go index a8f65af..3548d74 100644 --- a/internal/ccsmp/ccsmp_log_level_generated.go +++ b/internal/ccsmp/ccsmp_log_level_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_log_level_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_message.go b/internal/ccsmp/ccsmp_message.go index 28ca15a..0152281 100644 --- a/internal/ccsmp/ccsmp_message.go +++ b/internal/ccsmp/ccsmp_message.go @@ -17,6 +17,7 @@ package ccsmp /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include diff --git a/internal/ccsmp/ccsmp_message_tracing.go b/internal/ccsmp/ccsmp_message_tracing.go index 13dbbee..b416130 100644 --- a/internal/ccsmp/ccsmp_message_tracing.go +++ b/internal/ccsmp/ccsmp_message_tracing.go @@ -17,6 +17,7 @@ package ccsmp /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include diff --git a/internal/ccsmp/ccsmp_return_code_generated.go b/internal/ccsmp/ccsmp_return_code_generated.go index b6f137e..ec947ab 100644 --- a/internal/ccsmp/ccsmp_return_code_generated.go +++ b/internal/ccsmp/ccsmp_return_code_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_return_code_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_rmid.go b/internal/ccsmp/ccsmp_rmid.go index 0700e59..48cddd5 100644 --- a/internal/ccsmp/ccsmp_rmid.go +++ b/internal/ccsmp/ccsmp_rmid.go @@ -17,6 +17,7 @@ package ccsmp /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include diff --git a/internal/ccsmp/ccsmp_session_event_generated.go b/internal/ccsmp/ccsmp_session_event_generated.go index 1418497..637412f 100644 --- a/internal/ccsmp/ccsmp_session_event_generated.go +++ b/internal/ccsmp/ccsmp_session_event_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_session_event_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_session_prop_generated.go b/internal/ccsmp/ccsmp_session_prop_generated.go index c19abec..ce4185d 100644 --- a/internal/ccsmp/ccsmp_session_prop_generated.go +++ b/internal/ccsmp/ccsmp_session_prop_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_session_prop_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_session_stats_rx_generated.go b/internal/ccsmp/ccsmp_session_stats_rx_generated.go index 1e1fee4..3cef0b0 100644 --- a/internal/ccsmp/ccsmp_session_stats_rx_generated.go +++ b/internal/ccsmp/ccsmp_session_stats_rx_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_session_stats_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/ccsmp_session_stats_tx_generated.go b/internal/ccsmp/ccsmp_session_stats_tx_generated.go index 5c14f4f..7810bbe 100644 --- a/internal/ccsmp/ccsmp_session_stats_tx_generated.go +++ b/internal/ccsmp/ccsmp_session_stats_tx_generated.go @@ -19,6 +19,7 @@ package ccsmp // Code generated by ccsmp_session_stats_generator.go via go generate. DO NOT EDIT. /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include "solclient/solClient.h" */ import "C" diff --git a/internal/ccsmp/cgo_helpers.go b/internal/ccsmp/cgo_helpers.go index 378c3ac..8cdafb8 100644 --- a/internal/ccsmp/cgo_helpers.go +++ b/internal/ccsmp/cgo_helpers.go @@ -17,6 +17,7 @@ package ccsmp /* +#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO #include #include diff --git a/internal/ccsmp/generator/ccsmp_endpoint_prop_generator.go b/internal/ccsmp/generator/ccsmp_endpoint_prop_generator.go index 7390c7a..e446d8f 100644 --- a/internal/ccsmp/generator/ccsmp_endpoint_prop_generator.go +++ b/internal/ccsmp/generator/ccsmp_endpoint_prop_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_endpoint_prop_generated.go" -const header string = "package ccsmp\n// Code generated by ccsmp_endpoint_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n// Code generated by ccsmp_endpoint_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientEndpointProp" const definePrefix string = "SOLCLIENT_ENDPOINT_PROP" diff --git a/internal/ccsmp/generator/ccsmp_flow_event_generator.go b/internal/ccsmp/generator/ccsmp_flow_event_generator.go index 20f2bed..cff026d 100644 --- a/internal/ccsmp/generator/ccsmp_flow_event_generator.go +++ b/internal/ccsmp/generator/ccsmp_flow_event_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_flow_event_generated.go" -const header string = "package ccsmp\n\n// Code generated by ccsmp_flow_event_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n\n// Code generated by ccsmp_flow_event_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientFlowEvent" const typeName string = "SolClientFlowEvent" diff --git a/internal/ccsmp/generator/ccsmp_flow_prop_generator.go b/internal/ccsmp/generator/ccsmp_flow_prop_generator.go index a2a8d00..c294a5a 100644 --- a/internal/ccsmp/generator/ccsmp_flow_prop_generator.go +++ b/internal/ccsmp/generator/ccsmp_flow_prop_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_flow_prop_generated.go" -const header string = "package ccsmp\n// Code generated by ccsmp_flow_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n// Code generated by ccsmp_flow_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientFlowProp" const definePrefix string = "SOLCLIENT_FLOW_PROP" diff --git a/internal/ccsmp/generator/ccsmp_global_prop_generator.go b/internal/ccsmp/generator/ccsmp_global_prop_generator.go index 7d487a7..22f6f58 100644 --- a/internal/ccsmp/generator/ccsmp_global_prop_generator.go +++ b/internal/ccsmp/generator/ccsmp_global_prop_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_global_prop_generated.go" -const header string = "package ccsmp\n// Code generated by ccsmp_global_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n// Code generated by ccsmp_global_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientGlobalProp" const definePrefix string = "SOLCLIENT_GLOBAL_PROP" diff --git a/internal/ccsmp/generator/ccsmp_log_level_generator.go b/internal/ccsmp/generator/ccsmp_log_level_generator.go index d30d50d..d9e79a5 100644 --- a/internal/ccsmp/generator/ccsmp_log_level_generator.go +++ b/internal/ccsmp/generator/ccsmp_log_level_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_log_level_generated.go" -const header string = "package ccsmp\n\n// Code generated by ccsmp_log_level_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n\n// Code generated by ccsmp_log_level_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientLogLevel" const typeName string = "SolClientLogLevel" diff --git a/internal/ccsmp/generator/ccsmp_return_code_generator.go b/internal/ccsmp/generator/ccsmp_return_code_generator.go index 738e68b..4fd94a4 100644 --- a/internal/ccsmp/generator/ccsmp_return_code_generator.go +++ b/internal/ccsmp/generator/ccsmp_return_code_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_return_code_generated.go" -const header string = "package ccsmp\n\n// Code generated by ccsmp_return_code_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n\n// Code generated by ccsmp_return_code_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientReturnCode" const typeName string = "SolClientReturnCode" diff --git a/internal/ccsmp/generator/ccsmp_session_event_generator.go b/internal/ccsmp/generator/ccsmp_session_event_generator.go index de7bfa1..f49482c 100644 --- a/internal/ccsmp/generator/ccsmp_session_event_generator.go +++ b/internal/ccsmp/generator/ccsmp_session_event_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_session_event_generated.go" -const header string = "package ccsmp\n\n// Code generated by ccsmp_session_event_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n\n// Code generated by ccsmp_session_event_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientSessionEvent" const typeName string = "SolClientSessionEvent" diff --git a/internal/ccsmp/generator/ccsmp_session_prop_generator.go b/internal/ccsmp/generator/ccsmp_session_prop_generator.go index d72b97a..c9a3ba2 100644 --- a/internal/ccsmp/generator/ccsmp_session_prop_generator.go +++ b/internal/ccsmp/generator/ccsmp_session_prop_generator.go @@ -31,7 +31,7 @@ import ( // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. const outputFile string = "ccsmp_session_prop_generated.go" -const header string = "package ccsmp\n// Code generated by ccsmp_session_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n// Code generated by ccsmp_session_prop_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const namePrefix string = "SolClientSessionProp" const definePrefix string = "SOLCLIENT_SESSION_PROP" diff --git a/internal/ccsmp/generator/ccsmp_session_stats_generator.go b/internal/ccsmp/generator/ccsmp_session_stats_generator.go index 725e36c..72b67a0 100644 --- a/internal/ccsmp/generator/ccsmp_session_stats_generator.go +++ b/internal/ccsmp/generator/ccsmp_session_stats_generator.go @@ -30,7 +30,7 @@ import ( // It can be invoked by running `go generate` in the the ccsmp directory. // The environment variable SOLCLIENT_H must be set to the absolute path to project_root/lib//include/solclient/solClient.h. -const header string = "package ccsmp\n// Code generated by ccsmp_session_stats_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" +const header string = "package ccsmp\n// Code generated by ccsmp_session_stats_generator.go via go generate. DO NOT EDIT.\n\n\n/*\n#cgo CFLAGS: -DSOLCLIENT_PSPLUS_GO\n#include \"solclient/solClient.h\"\n*/\nimport \"C\"\nconst (\n" const footer string = ")\n" const outputFilePrefix string = "ccsmp_session_stats_" diff --git a/internal/ccsmp/includes_darwin_amd64.go b/internal/ccsmp/includes_darwin_amd64.go index 5715b54..62d58cd 100644 --- a/internal/ccsmp/includes_darwin_amd64.go +++ b/internal/ccsmp/includes_darwin_amd64.go @@ -18,7 +18,7 @@ package ccsmp /* // specific flags for darwin static builds in C -#cgo CFLAGS: -I${SRCDIR}/lib/include +#cgo CFLAGS: -I${SRCDIR}/lib/include -DSOLCLIENT_PSPLUS_GO #cgo LDFLAGS: -L/usr/local/opt/openssl/lib ${SRCDIR}/lib/darwin/libsolclient.a -lssl -lcrypto -framework Kerberos */ import "C" diff --git a/internal/ccsmp/includes_darwin_arm64.go b/internal/ccsmp/includes_darwin_arm64.go index fbb01e5..3d2a743 100644 --- a/internal/ccsmp/includes_darwin_arm64.go +++ b/internal/ccsmp/includes_darwin_arm64.go @@ -18,7 +18,7 @@ package ccsmp /* // specific flags for darwin static builds in C -#cgo CFLAGS: -I${SRCDIR}/lib/include +#cgo CFLAGS: -I${SRCDIR}/lib/include -DSOLCLIENT_PSPLUS_GO #cgo LDFLAGS: -L/opt/homebrew/opt/openssl/lib ${SRCDIR}/lib/darwin/libsolclient.a -lssl -lcrypto -framework Kerberos */ import "C" diff --git a/internal/ccsmp/includes_linux_amd64.go b/internal/ccsmp/includes_linux_amd64.go index d107cd5..b97c0e4 100644 --- a/internal/ccsmp/includes_linux_amd64.go +++ b/internal/ccsmp/includes_linux_amd64.go @@ -18,7 +18,7 @@ package ccsmp /* // specific flags for linux static builds in C -#cgo CFLAGS: -I${SRCDIR}/lib/include +#cgo CFLAGS: -I${SRCDIR}/lib/include -DSOLCLIENT_PSPLUS_GO #cgo LDFLAGS: ${SRCDIR}/lib/linux_amd64/libsolclient.a -lm -ldl -lpthread -lrt #include diff --git a/internal/ccsmp/includes_linux_arm64.go b/internal/ccsmp/includes_linux_arm64.go index 652fc4e..3cbb96b 100644 --- a/internal/ccsmp/includes_linux_arm64.go +++ b/internal/ccsmp/includes_linux_arm64.go @@ -18,7 +18,7 @@ package ccsmp /* // specific flags for linux static builds in C -#cgo CFLAGS: -I${SRCDIR}/lib/include +#cgo CFLAGS: -I${SRCDIR}/lib/include -DSOLCLIENT_PSPLUS_GO #cgo LDFLAGS: ${SRCDIR}/lib/linux_arm64/libsolclient.a -lm -ldl -lpthread -lrt #include diff --git a/internal/ccsmp/lib/include/solclient/solClient.h b/internal/ccsmp/lib/include/solclient/solClient.h index 2e7fb3c..859b7ce 100644 --- a/internal/ccsmp/lib/include/solclient/solClient.h +++ b/internal/ccsmp/lib/include/solclient/solClient.h @@ -568,6 +568,18 @@ typedef char ** solClient_propertyArray_pt; /**< pointer to an array of s * is returned from solClient_context_create() when a Context is created, and it is passed into other * APIs that operate on a Context. */ +#if defined(SOLCLIENT_PSPLUS_GO) +#include +typedef uintptr_t solClient_opaqueContext_pt; /**< An opaque pointer to a processing Context. */ +typedef uintptr_t solClient_opaqueSession_pt; /**< An opaque pointer to a Session. */ +typedef uintptr_t solClient_opaqueFlow_pt; /**< An opaque pointer to a Flow. */ +typedef uintptr_t solClient_opaqueMsg_pt; /**< An opaque pointer to a message. */ +typedef uintptr_t solClient_opaqueContainer_pt; /**< An opaque pointer to a container (such as a map or stream). */ +typedef uintptr_t solClient_opaqueDatablock_pt; /**< An opaque pointer to a data block. */ +typedef uintptr_t solClient_opaqueTransactedSession_pt; /**< An opaque pointer to a Transacted Session. */ +/*@}*/ +typedef void * *solClient_opaquePointer_pt; /**< An opaque pointer to a pointer */ +#else typedef void *solClient_opaqueContext_pt; /**< An opaque pointer to a processing Context. */ typedef void *solClient_opaqueSession_pt; /**< An opaque pointer to a Session. */ typedef void *solClient_opaqueFlow_pt; /**< An opaque pointer to a Flow. */ @@ -577,6 +589,7 @@ typedef void *solClient_opaqueDatablock_pt; /**< An opaqu typedef void *solClient_opaqueTransactedSession_pt; /**< An opaque pointer to a Transacted Session. */ /*@}*/ typedef void * *solClient_opaquePointer_pt; /**< An opaque pointer to a pointer */ +#endif /** * @enum solClient_destinationType diff --git a/internal/impl/message/message_test.go b/internal/impl/message/message_test.go index cd62cf8..9235c13 100644 --- a/internal/impl/message/message_test.go +++ b/internal/impl/message/message_test.go @@ -29,7 +29,7 @@ func TestOutboundMessageFree(t *testing.T) { if err != nil { t.Error("did not expect error, got " + err.Error()) } - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -39,7 +39,7 @@ func TestOutboundMessageFree(t *testing.T) { if !msg.IsDisposed() { t.Error("IsDisposed returned false, expected true") } - if msg.messagePointer != nil { + if msg.messagePointer != ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected MessagePointer to be freed and set to nil, it was not") } } @@ -50,7 +50,7 @@ func TestInboundMessageFree(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -60,7 +60,7 @@ func TestInboundMessageFree(t *testing.T) { if !msg.IsDisposed() { t.Error("IsDisposed returned false, expected true") } - if msg.messagePointer != nil { + if msg.messagePointer != ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected MessagePointer to be freed and set to nil, it was not") } } @@ -85,7 +85,7 @@ func TestSetCreationTraceContext(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -145,7 +145,7 @@ func TestGetCreationTraceContext(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -208,7 +208,7 @@ func TestSetTransportTraceContext(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -268,7 +268,7 @@ func TestGetTransportTraceContext(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -323,7 +323,7 @@ func TestSetBaggage(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { @@ -357,7 +357,7 @@ func TestGetBaggage(t *testing.T) { t.Error("did not expect error, got " + ccsmpErr.GetMessageAsString()) } msg := NewInboundMessage(msgP, false) - if msg.messagePointer == nil { + if msg.messagePointer == ccsmp.SolClientOpaquePointerInvalidValue { t.Error("expected message pointer to not be nil") } if msg.IsDisposed() { diff --git a/internal/impl/message/outbound_message_impl.go b/internal/impl/message/outbound_message_impl.go index c7071fe..33a56bd 100644 --- a/internal/impl/message/outbound_message_impl.go +++ b/internal/impl/message/outbound_message_impl.go @@ -166,7 +166,7 @@ func SetAsReplyMessage(message *OutboundMessageImpl, replyToDestination string, // GetOutboundMessagePointer function func GetOutboundMessagePointer(message *OutboundMessageImpl) ccsmp.SolClientMessagePt { if message == nil { - return nil + return ccsmp.SolClientOpaquePointerInvalidValue } return message.messagePointer } diff --git a/internal/impl/publisher/request_reply_message_publisher_impl.go b/internal/impl/publisher/request_reply_message_publisher_impl.go index 3231d6d..9e49eb4 100644 --- a/internal/impl/publisher/request_reply_message_publisher_impl.go +++ b/internal/impl/publisher/request_reply_message_publisher_impl.go @@ -877,12 +877,12 @@ func (publisher *requestReplyMessagePublisherImpl) handleReplyMessage(msgP core. defer publisher.rxLock.Unlock() corEntry, ok := publisher.requestCorrelationMap[correlationID] if !ok { - publisher.logger.Debug(fmt.Sprintf("Received reply message[%p] with correlationID[%s] without correlation entry for publisher", msgP, correlationID)) + publisher.logger.Debug(fmt.Sprintf("Received reply message[0x%x] with correlationID[%s] without correlation entry for publisher", msgP, correlationID)) return false } if corEntry.received { // return false to return the message - publisher.logger.Debug(fmt.Sprintf("Received reply message[%p] with correlationID[%s] that already has response", msgP, correlationID)) + publisher.logger.Debug(fmt.Sprintf("Received reply message[0x%x] with correlationID[%s] that already has response", msgP, correlationID)) return false } corEntry.received = true diff --git a/version.go b/version.go index 9727653..e0eda40 100644 --- a/version.go +++ b/version.go @@ -23,4 +23,4 @@ func init() { core.SetVersion(version) } -const version = "1.8.0" +const version = "1.8.1"