Exemplo n.º 1
0
void Blackadder::publish_scope(const string&id, const string&prefix_id, unsigned char strategy, void *str_opt, unsigned int str_opt_len) {
    int ret;
    if (id.length() % PURSUIT_ID_LEN != 0) {
        cout << "Blackadder Library: Could not send PUBLISH_SCOPE request - wrong ID size" << endl;
    } else if (prefix_id.length() % PURSUIT_ID_LEN != 0) {
        cout << "Blackadder Library: Could not send PUBLISH_SCOPE request - wrong prefix_id size" << endl;
    } else if (id.length() == 0) {
        cout << "Blackadder Library: Could not send PUBLISH_SCOPE request - id cannot be empty" << endl;
    } else {
        ret = create_and_send_buffers(PUBLISH_SCOPE, id, prefix_id, strategy, str_opt, str_opt_len);
        if (ret < 0) {
            perror("Blackadder Library: Could not send PUBLISH_SCOPE request");
        }
    }
}
Exemplo n.º 2
0
void Blackadder::unsubscribe_scope(const string&id, const string&prefix_id, unsigned char strategy, void *str_opt, unsigned int str_opt_len) {
    int ret;
    if (id.length() % PURSUIT_ID_LEN != 0) {
        cout << "Blackadder Library: Could not send UNSUBSCRIBE_SCOPE request - wrong ID size" << endl;
    } else if (prefix_id.length() % PURSUIT_ID_LEN != 0) {
        cout << "Blackadder Library: Could not send UNSUBSCRIBE_SCOPE request - wrong prefix_id size" << endl;
    } else if (id.length() == 0) {
        cout << "Blackadder Library: Could not send UNSUBSCRIBE_SCOPE request - id cannot be empty" << endl;
    } else if (id.length() / PURSUIT_ID_LEN > 1) {
        cout << "Blackadder Library: Could not send UNSUBSCRIBE_SCOPE request - id cannot consist of multiple fragments" << endl;
    } else {
        ret = create_and_send_buffers(UNSUBSCRIBE_SCOPE, id, prefix_id, strategy, str_opt, str_opt_len);
        if (ret < 0) {
            perror("Blackadder Library: Could not send UNSUBSCRIBE_SCOPE request");
        }
    }
}
Exemplo n.º 3
0
void Blackadder::kc_subscribe(const string &id, const string &prefix_id, unsigned char strategy, unsigned char reservied_face) {
    int ret;
    if (id.length() % PURSUIT_ID_LEN != 0) {
        cout << "Blackadder Library: Could not send SUBSCRIBE_SCOPE request - wrong ID size" << endl;
    } else if (prefix_id.length() % PURSUIT_ID_LEN != 0) {
        cout << "Blackadder Library: Could not send SUBSCRIBE_SCOPE request - wrong prefix_id size" << endl;
    } else if (id.length() == 0) {
        cout << "Blackadder Library: Could not send SUBSCRIBE_SCOPE request - id cannot be empty" << endl;
    } else if (id.length() / PURSUIT_ID_LEN > 1) {
        cout << "Blackadder Library: Could not send SUBSCRIBE_SCOPE request - id cannot consist of multiple fragments" << endl;
    } else {
        ret = create_and_send_buffers(KC_SUB_SCOPE, id, prefix_id, strategy, NULL, 0);
        if (ret < 0) {
            perror("Blackadder Library: Could not send SUBSCRIBE_SCOPE request");
        }
    }
}
Exemplo n.º 4
0
void
blackadder::unpublish_scope (const string &id, const string &prefix_id, unsigned char strategy, void *str_opt, unsigned int str_opt_len)
{
  int ret;
  if (str_opt_len < 0) {
    cout << "str_opt_len must be >= 0" << endl;
  } else if (id.length () % PURSUIT_ID_LEN != 0) {
    cout << "UNPUBLISH_SCOPE request - wrong ID size" << endl;
  } else if (prefix_id.length () % PURSUIT_ID_LEN != 0) {
    cout << "UNPUBLISH_SCOPE request - wrong prefix_id size" << endl;
  } else if (id.length () == 0) {
    cout << "UNPUBLISH_SCOPE request - id cannot be empty" << endl;
  } else if (id.length () / PURSUIT_ID_LEN > 1) {
    cout << "UNPUBLISH_SCOPE request - id cannot consist of multiple fragments" << endl;
  } else {
    ret = create_and_send_buffers (UNPUBLISH_SCOPE, id, prefix_id, strategy, str_opt, str_opt_len);
    if (ret < 0) {
      perror ("UNPUBLISH_SCOPE request");
    }
  }
}
Exemplo n.º 5
0
void
blackadder::publish_info (const string &id, const string &prefix_id, unsigned char strategy, void *str_opt, unsigned int str_opt_len)
{
  int ret;
  if (str_opt_len < 0) {
    cout << "str_opt_len must be >= 0" << endl;
  } else if (id.length () % PURSUIT_ID_LEN != 0) {
    cout << "PUBLISH_INFO request - wrong ID size" << endl;
  } else if (prefix_id.length () % PURSUIT_ID_LEN != 0) {
    cout << "PUBLISH_INFO request - wrong prefix_id size" << endl;
  } else if (prefix_id.length () == 0) {
    cout << "PUBLISH_INFO request - prefix_id cannot be empty" << endl;
  } else if (prefix_id.length () == 0) {
    cout << "PUBLISH_INFO request - prefix_id cannot be empty" << endl;
  } else {
    ret = create_and_send_buffers (PUBLISH_INFO, id, prefix_id, strategy, str_opt, str_opt_len);
    if (ret < 0) {
      perror ("PUBLISH_INFO request");
    }
  }
}
Exemplo n.º 6
0
void
blackadder::subscribe_info (const string &id, const string &prefix_id, unsigned char strategy, void *str_opt, unsigned int str_opt_len)
{
  int ret;
  if (str_opt_len < 0) {
    cout << "str_opt_len must be >= 0" << endl;
  } else if (id.length () % PURSUIT_ID_LEN != 0) {
    cout << "SUBSCRIBE_INFO request - wrong ID size" << endl;
  } else if (prefix_id.length () % PURSUIT_ID_LEN != 0) {
    cout << "SUBSCRIBE_INFO request - wrong prefix_id size" << endl;
  } else if (id.length () == 0) {
    cout << "SUBSCRIBE_INFO request - id cannot be empty" << endl;
  } else if (prefix_id.length () == 0) {
    cout << "SUBSCRIBE_INFO request - prefix_id cannot be empty" << endl;
  } else if (id.length () / PURSUIT_ID_LEN > 1) {
    cout << "SUBSCRIBE_INFO request - id cannot consist of multiple fragments" << endl;
  } else {
    ret = create_and_send_buffers (SUBSCRIBE_INFO, id, prefix_id, strategy, str_opt, str_opt_len);
    if (ret < 0) {
      perror ("SUBSCRIBE_INFO request");
    }
  }
}