|
@@ -54,12 +54,12 @@ typedef struct TCPConnectionHandle {
|
|
UA_StatusCode NetworklayerTCP_new(NetworklayerTCP **newlayer, UA_ConnectionConfig localConf,
|
|
UA_StatusCode NetworklayerTCP_new(NetworklayerTCP **newlayer, UA_ConnectionConfig localConf,
|
|
UA_UInt32 port) {
|
|
UA_UInt32 port) {
|
|
*newlayer = malloc(sizeof(NetworklayerTCP));
|
|
*newlayer = malloc(sizeof(NetworklayerTCP));
|
|
- if(*newlayer == UA_NULL)
|
|
|
|
|
|
+ if(*newlayer == NULL)
|
|
return UA_STATUSCODE_BADOUTOFMEMORY;
|
|
return UA_STATUSCODE_BADOUTOFMEMORY;
|
|
(*newlayer)->localConf = localConf;
|
|
(*newlayer)->localConf = localConf;
|
|
(*newlayer)->port = port;
|
|
(*newlayer)->port = port;
|
|
(*newlayer)->connectionsSize = 0;
|
|
(*newlayer)->connectionsSize = 0;
|
|
- (*newlayer)->connections = UA_NULL;
|
|
|
|
|
|
+ (*newlayer)->connections = NULL;
|
|
return UA_STATUSCODE_GOOD;
|
|
return UA_STATUSCODE_GOOD;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -76,7 +76,7 @@ static UA_StatusCode NetworklayerTCP_remove(NetworklayerTCP *layer, UA_Int32 soc
|
|
return UA_STATUSCODE_BADINTERNALERROR;
|
|
return UA_STATUSCODE_BADINTERNALERROR;
|
|
|
|
|
|
if(layer->connections[index].connection.channel)
|
|
if(layer->connections[index].connection.channel)
|
|
- layer->connections[index].connection.channel->connection = UA_NULL;
|
|
|
|
|
|
+ layer->connections[index].connection.channel->connection = NULL;
|
|
|
|
|
|
UA_Connection_deleteMembers(&layer->connections[index].connection);
|
|
UA_Connection_deleteMembers(&layer->connections[index].connection);
|
|
|
|
|
|
@@ -95,7 +95,7 @@ void NetworklayerTCP_delete(NetworklayerTCP *layer) {
|
|
for(UA_UInt32 index = 0;index < layer->connectionsSize;index++) {
|
|
for(UA_UInt32 index = 0;index < layer->connectionsSize;index++) {
|
|
shutdown(layer->connections[index].sockfd, 2);
|
|
shutdown(layer->connections[index].sockfd, 2);
|
|
if(layer->connections[index].connection.channel)
|
|
if(layer->connections[index].connection.channel)
|
|
- layer->connections[index].connection.channel->connection = UA_NULL;
|
|
|
|
|
|
+ layer->connections[index].connection.channel->connection = NULL;
|
|
UA_Connection_deleteMembers(&layer->connections[index].connection);
|
|
UA_Connection_deleteMembers(&layer->connections[index].connection);
|
|
CLOSESOCKET(layer->connections[index].sockfd);
|
|
CLOSESOCKET(layer->connections[index].sockfd);
|
|
}
|
|
}
|
|
@@ -139,8 +139,8 @@ void writeCallback(TCPConnectionHandle *handle, UA_ByteStringArray gather_buf) {
|
|
iov[i].iov_len = gather_buf.strings[i].length;
|
|
iov[i].iov_len = gather_buf.strings[i].length;
|
|
total_len += gather_buf.strings[i].length;
|
|
total_len += gather_buf.strings[i].length;
|
|
}
|
|
}
|
|
- struct msghdr message = {.msg_name = UA_NULL, .msg_namelen = 0, .msg_iov = iov,
|
|
|
|
- .msg_iovlen = gather_buf.stringsSize, .msg_control = UA_NULL,
|
|
|
|
|
|
+ struct msghdr message = {.msg_name = NULL, .msg_namelen = 0, .msg_iov = iov,
|
|
|
|
+ .msg_iovlen = gather_buf.stringsSize, .msg_control = NULL,
|
|
.msg_controllen = 0, .msg_flags = 0};
|
|
.msg_controllen = 0, .msg_flags = 0};
|
|
while (nWritten < total_len) {
|
|
while (nWritten < total_len) {
|
|
UA_Int32 n = 0;
|
|
UA_Int32 n = 0;
|
|
@@ -303,7 +303,7 @@ UA_StatusCode NetworkLayerTCP_run(NetworklayerTCP *layer, UA_Server *server, str
|
|
while (*running) {
|
|
while (*running) {
|
|
setFDSet(layer);
|
|
setFDSet(layer);
|
|
struct timeval tmptv = tv;
|
|
struct timeval tmptv = tv;
|
|
- UA_Int32 resultsize = select(layer->highestfd, &layer->fdset, UA_NULL, UA_NULL, &tmptv);
|
|
|
|
|
|
+ UA_Int32 resultsize = select(layer->highestfd, &layer->fdset, NULL, NULL, &tmptv);
|
|
if (resultsize <= 0) {
|
|
if (resultsize <= 0) {
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
UA_Int32 err = (resultsize == SOCKET_ERROR) ? WSAGetLastError() : 0;
|
|
UA_Int32 err = (resultsize == SOCKET_ERROR) ? WSAGetLastError() : 0;
|