Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
83c2a1b9
Commit
83c2a1b9
authored
Dec 21, 2010
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unetexchange.cc
parent
2579a499
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
start_fg_unetexchange.sh
extensions/UDPExchange/start_fg_unetexchange.sh
+6
-0
unetexchange.cc
extensions/UDPExchange/unetexchange.cc
+88
-0
No files found.
extensions/UDPExchange/start_fg_unetexchange.sh
0 → 100755
View file @
83c2a1b9
#!/bin/sh
uniset-start.sh
-f
./uniset-unetexchange
--unet-name
UNetExchange
\
--confile
test.xml
\
--unet-filter-field
rs
--unet-filter-value
2
\
--dlog-add-levels
info,crit,warn
extensions/UDPExchange/unetexchange.cc
0 → 100644
View file @
83c2a1b9
#include <sstream>
#include "ObjectsActivator.h"
#include "Extensions.h"
#include "UNetExchange.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
int
main
(
int
argc
,
char
**
argv
)
{
try
{
if
(
argc
>
1
&&
(
!
strcmp
(
argv
[
1
],
"--help"
)
||
!
strcmp
(
argv
[
1
],
"-h"
))
)
{
cout
<<
"--smemory-id objectName - SharedMemory objectID. Default: read from <SharedMemory>"
<<
endl
;
cout
<<
"--confile filename - configuration file. Default: configure.xml"
<<
endl
;
cout
<<
"--unet-logfile filename - logfilename. Default: udpexchange.log"
<<
endl
;
cout
<<
endl
;
UNetExchange
::
help_print
(
argc
,
argv
);
return
0
;
}
string
confile
=
UniSetTypes
::
getArgParam
(
"--confile"
,
argc
,
argv
,
"configure.xml"
);
conf
=
new
Configuration
(
argc
,
argv
,
confile
);
string
logfilename
(
conf
->
getArgParam
(
"--unet-logfile"
));
if
(
logfilename
.
empty
()
)
logfilename
=
"udpexchange.log"
;
conf
->
initDebug
(
dlog
,
"dlog"
);
std
::
ostringstream
logname
;
string
dir
(
conf
->
getLogDir
());
logname
<<
dir
<<
logfilename
;
unideb
.
logFile
(
logname
.
str
()
);
dlog
.
logFile
(
logname
.
str
()
);
ObjectId
shmID
=
DefaultObjectId
;
string
sID
=
conf
->
getArgParam
(
"--smemory-id"
);
if
(
!
sID
.
empty
()
)
shmID
=
conf
->
getControllerID
(
sID
);
else
shmID
=
getSharedMemoryID
();
if
(
shmID
==
DefaultObjectId
)
{
cerr
<<
sID
<<
"? SharedMemoryID not found in "
<<
conf
->
getControllersSection
()
<<
" section"
<<
endl
;
return
1
;
}
UNetExchange
*
unet
=
UNetExchange
::
init_unetexchange
(
argc
,
argv
,
shmID
);
if
(
!
unet
)
{
dlog
[
Debug
::
CRIT
]
<<
"(unetexchange): init failed.."
<<
endl
;
return
1
;
}
ObjectsActivator
act
;
act
.
addObject
(
static_cast
<
class
UniSetObject
*>
(
unet
));
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
.
broadcast
(
sm
.
transport_msg
()
);
unideb
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
unideb
[
Debug
::
ANY
]
<<
"(main): -------------- UDPRecevier START -------------------------
\n\n
"
;
dlog
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
dlog
[
Debug
::
ANY
]
<<
"(main): -------------- UDPReceiver START -------------------------
\n\n
"
;
act
.
run
(
false
);
}
catch
(
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
"(unetexchange): "
<<
ex
<<
std
::
endl
;
}
catch
(
ost
::
SockException
&
e
)
{
ostringstream
s
;
s
<<
e
.
getString
()
<<
": "
<<
e
.
getSystemErrorString
();
dlog
[
Debug
::
CRIT
]
<<
s
.
str
()
<<
endl
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
"(unetexchange): catch ..."
<<
std
::
endl
;
}
return
0
;
}
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