Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
f58812b3
Commit
f58812b3
authored
May 14, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NodeConfig and Modbus TCP, hostname instead of address
parent
305c155b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
86 additions
and
10 deletions
+86
-10
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
+7
-1
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+2
-2
remote/wbl/remote/src/remote_c_remnodetcp.wb_load
remote/wbl/remote/src/remote_c_remnodetcp.wb_load
+1
-1
remote/wbl/remote/src/remote_c_remnodeudp.wb_load
remote/wbl/remote/src/remote_c_remnodeudp.wb_load
+1
-1
src/lib/rt/src/rt_net.c
src/lib/rt/src/rt_net.c
+36
-0
src/lib/rt/src/rt_net.x
src/lib/rt/src/rt_net.x
+1
-0
src/lib/rt/src/rt_qini.c
src/lib/rt/src/rt_qini.c
+36
-3
src/wbl/pwrb/src/pwrb_c_nodeconfig.wb_load
src/wbl/pwrb/src/pwrb_c_nodeconfig.wb_load
+1
-1
wb/lib/wb/src/wb_lfu.cpp
wb/lib/wb/src/wb_lfu.cpp
+1
-1
No files found.
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
View file @
f58812b3
...
...
@@ -58,6 +58,7 @@
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_net.h"
#include "co_cdh.h"
#include "co_time.h"
#include "rt_mb_msg.h"
...
...
@@ -103,7 +104,12 @@ static int connect_slave( io_sRackLocal *local, io_sRack *rp)
local
->
rem_addr
.
sin_family
=
AF_INET
;
local
->
rem_addr
.
sin_port
=
htons
(
port
);
local
->
rem_addr
.
sin_addr
.
s_addr
=
inet_addr
((
char
*
)
&
(
op
->
Address
));
// local->rem_addr.sin_addr.s_addr = inet_addr((char *) &(op->Address));
sts
=
net_StringToAddr
(
op
->
Address
,
&
local
->
rem_addr
.
sin_addr
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"Address error for IO modbus tcp slave %s %s"
,
rp
->
Name
,
op
->
Address
);
return
sts
;
}
/* Connect to remote address */
...
...
otherio/wbl/mcomp/src/otherio.wb_load
View file @
f58812b3
...
...
@@ -1238,9 +1238,9 @@ Volume OtherIO $ClassVolume 0.0.250.10
! IP-address for the remote node. Dynamic change is not possible.
!*/
Object Address $Attribute 6 08-FEB-2008 10:44:42.47
Body SysBody
08-FEB-2008 10:47:01.34
Body SysBody
14-MAY-2012 13:53:27.76
Attr PgmName = "Address"
Attr TypeRef = "pwrs:Type-$String
32
"
Attr TypeRef = "pwrs:Type-$String
80
"
EndBody
EndObject
!/**
...
...
remote/wbl/remote/src/remote_c_remnodetcp.wb_load
View file @
f58812b3
...
...
@@ -89,7 +89,7 @@ SObject Remote:Class
!*/
Object RemoteHostname $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$String
32
"
Attr TypeRef = "pwrs:Type-$String
80
"
EndBody
EndObject
!/**
...
...
remote/wbl/remote/src/remote_c_remnodeudp.wb_load
View file @
f58812b3
...
...
@@ -89,7 +89,7 @@ SObject Remote:Class
!*/
Object RemoteHostname $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$String
32
"
Attr TypeRef = "pwrs:Type-$String
80
"
EndBody
EndObject
!/**
...
...
src/lib/rt/src/rt_net.c
View file @
f58812b3
...
...
@@ -59,6 +59,10 @@
# include <stddef.h>
# include <string.h>
# include <pthread.h>
# include <sys/types.h>
# include <sys/socket.h>
# include <arpa/inet.h>
# include <netdb.h>
#endif
#include "pwr.h"
...
...
@@ -813,3 +817,35 @@ int net_GetTime( net_sTime *nt)
nt
->
tv_nsec
=
t
.
tv_nsec
;
return
sts
;
}
int
net_StringToAddr
(
char
*
str
,
struct
in_addr
*
naddr
)
{
naddr
->
s_addr
=
inet_network
(
str
);
if
(
naddr
->
s_addr
==
(
unsigned
int
)
-
1
)
{
/* Try name instead */
struct
addrinfo
hints
;
struct
addrinfo
*
res
;
int
err
;
memset
((
void
*
)
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_socktype
=
SOCK_STREAM
;
err
=
getaddrinfo
(
str
,
0
,
&
hints
,
&
res
);
if
(
err
<
0
)
{
return
0
;
}
switch
(
res
->
ai_family
)
{
case
AF_INET
:
memcpy
(
&
naddr
->
s_addr
,
(
char
*
)
&
res
->
ai_addr
->
sa_data
+
2
,
4
);
naddr
->
s_addr
=
ntohl
(
naddr
->
s_addr
);
break
;
case
AF_INET6
:
/* Not yet implemented */
return
0
;
break
;
}
freeaddrinfo
(
res
);
}
return
1
;
}
src/lib/rt/src/rt_net.x
View file @
f58812b3
...
...
@@ -1629,6 +1629,7 @@ struct net_sUpdateCircBuffer {
%net_sTime net_DeltaTimeToNetTime( const pwr_tDeltaTime *t);
%net_sTime net_DeltaTimeToNetTime( const pwr_tDeltaTime *t);
%int net_GetTime( net_sTime *nt);
%int net_StringToAddr( char *str, struct in_addr *naddr);
%
%#endif
%
...
...
src/lib/rt/src/rt_qini.c
View file @
f58812b3
...
...
@@ -35,6 +35,8 @@
*/
/* rt_qini.c -- Queue Communication, initiation */
#include <string.h>
#include <stdlib.h>
#include "pwr.h"
#include "rt_errh.h"
...
...
@@ -45,6 +47,7 @@
#include "co_cdh.h"
#include "rt_qini.h"
#include "rt_inet.h"
#include "rt_net.h"
static
qdb_sNode
*
...
...
@@ -156,16 +159,46 @@ qini_ParseFile (
continue
;
}
sts
=
net_StringToAddr
(
s_naddr
,
&
naddr
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"error in line, <network address>, skip to next line.
\n
>> %s"
,
s
);
(
*
errors
)
++
;
continue
;
}
#if 0
naddr.s_addr = inet_network(s_naddr);
#if defined(OS_VMS)
if (naddr.s_addr == (in_addr_t)-1) {
#else
if (naddr.s_addr == (unsigned int)-1) {
#endif
errh_Error
(
"error in line, <network address>, skip to next line.
\n
>> %s"
,
s
);
(
*
errors
)
++
;
continue
;
/* Try name instead */
struct
addrinfo
hints
;
struct
addrinfo
*
res
;
int
err
;
memset
((
void
*
)
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_socktype
=
SOCK_STREAM
;
err
=
getaddrinfo
(
s_naddr
,
0
,
&
hints
,
&
res
);
if
(
err
<
0
)
{
errh_Error
(
"error in line, <network address>, skip to next line.
\n
>> %s"
,
s
);
(
*
errors
)
++
;
continue
;
}
switch
(
res
->
ai_family
)
{
case
AF_INET
:
// memcpy( &naddr.s_addr, (char *)&res->ai_addr->sa_data + 2, 4);
memcpy
(
&
naddr
.
s_addr
,
&
((
struct
sock_addr_in
*
)
res
->
ai_addr
)
->
sin_addr
,
4
);
naddr
.
s_addr
=
ntohl
(
naddr
.
s_addr
);
break
;
case
AF_INET6
:
break
;
}
freeaddrinfo
(
res
);
}
#endif
nep
=
tree_Find
(
&
sts
,
ntp
,
&
nid
);
if
(
nep
!=
NULL
)
{
...
...
src/wbl/pwrb/src/pwrb_c_nodeconfig.wb_load
View file @
f58812b3
...
...
@@ -132,7 +132,7 @@ SObject pwrb:Class
!*/
Object Address $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$String
16
"
Attr TypeRef = "pwrs:Type-$String
80
"
EndBody
EndObject
!/**
...
...
wb/lib/wb/src/wb_lfu.cpp
View file @
f58812b3
...
...
@@ -96,7 +96,7 @@ public:
pwr_tOid
oid
;
pwr_tEnum
operatingsystem
;
pwr_tString80
nodename
;
pwr_tString
16
address
;
pwr_tString
80
address
;
pwr_tUInt32
port
;
pwr_tVid
vid
;
pwr_tEnum
connection
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment