-size_t left = 0, pos = 0, arcPos = 0;
-int arcs[1024];
-pos = str.find_first_of('.', left);
-if (pos == 0)
- {
- left = 1;
- pos = str.find_first_of('.', left);
- }
-while (pos != std::string::npos)
- {
- int arc = 0;
- if (str2x(str.substr(left, left - pos), arc))
- {
- return false;
- }
- arcs[arcPos++] = arc;
- left = pos + 1;
- pos = str.find_first_of('.', left);
- }
-if (left < str.length())
- {
- int arc = 0;
- if (str2x(str.substr(left, left - pos), arc))
- {
- return false;
- }
- arcs[arcPos++] = arc;
- }
-printfd(__FILE__, "String2OI() - arcPos: %d\n", arcPos);
-OBJECT_IDENTIFIER_set_arcs(oi, arcs, sizeof(arcs[0]), arcPos);
-return true;
-}
-
-class SMUX_CREATOR
-{
-private:
- SMUX * smux;
-
-public:
- SMUX_CREATOR() : smux(new SMUX()) {}
- ~SMUX_CREATOR() { delete smux; }
-
- SMUX * GetPlugin() { return smux; }
-};
-
-SMUX_CREATOR sac;
-
-PLUGIN * GetPlugin()
-{
-return sac.GetPlugin();
-}
-
-int SendOpenPDU(int fd)
-{
-const char * description = "Stg SMUX Plugin";
-//int oid[] = {1, 3, 6, 1, 4, 1, 38313, 1, 5, 2, 1, 1};
-asn_enc_rval_t error;
-OpenPDU_t msg;
-
-memset(&msg, 0, sizeof(msg));
-
-msg.present = OpenPDU_PR_simple;
-asn_long2INTEGER(&msg.choice.simple.version, SimpleOpen__version_version_1);
-if (!String2OI(".1.3.6.1.4.1.38313", &msg.choice.simple.identity))
- {
- printfd(__FILE__,
- "SendOpenPDU() - failed to convert string to OBJECT_IDENTIFIER\n");
- return -1;
- }
-OCTET_STRING_fromString(&msg.choice.simple.description, description);
-OCTET_STRING_fromString(&msg.choice.simple.password, "");
-
-char buffer[1024];
-error = der_encode_to_buffer(&asn_DEF_OpenPDU, &msg, buffer, sizeof(buffer));
-
-if (error.encoded == -1)
- {
- printfd(__FILE__, "Could not encode OpenPDU (at %s)\n",
- error.failed_type ? error.failed_type->name : "unknown");
- return -1;
- }
-else
- {
- write(fd, buffer, error.encoded);
- printfd(__FILE__, "OpenPDU encoded successfully to %d bytes\n",
- error.encoded);
- }
-return 0;
-}
-
-int SendClosePDU(int fd)
-{
-ClosePDU_t msg;
-
-memset(&msg, 0, sizeof(msg));
-
-asn_long2INTEGER(&msg, ClosePDU_goingDown);