124 unsigned long node = (
unsigned long)-1;
129 if (HP.
IsKeyWord(
"stream" "drive" "name")) {
132 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
133 "unable to read mailbox name "
137 }
else if (strlen(m) != 6) {
138 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
139 "illegal mailbox name \"" << m <<
"\" "
140 "(must be exactly 6 chars) "
148 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
149 "missing mailbox name "
156 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
157 "\"create\" must be \"yes\" or \"no\" "
164 silent_cout(
"RTMBDynInDrive(" << uLabel <<
"): "
165 "RTMBDyn mailboxes are always non-blocking"
172 silent_cout(
"RTMBDynInDrive(" << uLabel <<
"): "
173 "local path \"" << m <<
"\" silently ignored"
180 silent_cout(
"RTMBDynInDrive(" << uLabel <<
"): "
181 "port " << p <<
" silently ignored" << std::endl);
189 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
190 "unable to read host "
196 silent_cout(
"RTMBDynInDrive(" << uLabel <<
"): "
197 "host name \"" << h <<
"\" silently ignored"
204 #if defined(HAVE_GETADDRINFO)
205 struct addrinfo hints = { 0 }, *res = NULL;
208 hints.ai_family = AF_INET;
209 hints.ai_socktype = SOCK_STREAM;
210 rc = getaddrinfo(host.c_str(), NULL, &hints, &res);
212 node = ((
struct sockaddr_in *)res->ai_addr)->sin_addr.s_addr;
215 #elif defined(HAVE_GETHOSTBYNAME)
217 struct hostent *he = gethostbyname(host.c_str());
220 node = ((
unsigned long *)he->h_addr_list[0])[0];
222 #elif defined(HAVE_INET_ATON)
224 if (inet_aton(host.c_str(), &addr)) {
227 #else // ! HAVE_GETADDRINFO && ! HAVE_GETHOSTBYNAME && ! HAVE_INET_ATON
228 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
229 "host (RTAI RPC) not supported "
232 #endif // ! HAVE_GETADDRINFO && ! HAVE_GETHOSTBYNAME && ! HAVE_INET_ATON
234 if (node == (
unsigned long)-1) {
235 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
236 "unable to convert host \"" << host <<
"\" to node" << std::endl);
242 bool bNonBlocking(
true);
247 }
else if (HP.
IsKeyWord(
"no" "signal")) {
251 bNonBlocking =
false;
253 }
else if (HP.
IsKeyWord(
"non" "blocking")) {
261 int idrives = HP.
GetInt();
263 silent_cerr(
"RTMBDynInDrive(" << uLabel <<
"): "
264 "illegal number of channels "
269 std::vector<doublereal>
v0;
272 for (
int i = 0; i < idrives; i++) {
286 name,
host, idrives,
v0, pMod,
287 create, node, bNonBlocking));
#define MBDYN_EXCEPT_ARGS
virtual integer GetInt(integer iDefval=0)
StreamDrive::Modifier * ReadStreamDriveModifier(MBDynParser &HP, integer nDrives)
const DriveHandler * pGetDrvHdl(void) const
virtual bool IsKeyWord(const char *sKeyWord)
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
virtual bool GetYesNo(bool &bRet)
static const std::vector< doublereal > v0
virtual HighParser::ErrOut GetLineData(void) const
virtual doublereal GetReal(const doublereal &dDefval=0.0)