Example #1
0
void print_finger_list(FILE *out, Finger *fhead)
{
	int i;
	Finger *f;

	for (f = fhead, i = 0; f; f = f->next, i++) {
		fprintf(out, "	[%d] ", i);
		print_finger(out, f, "", "");
	}
}
Example #2
0
static LmSSLResponse
ssl_cb (LmSSL       *ssl, 
        LmSSLStatus  status, 
        gpointer     ud)
{
    g_print ("LmSendAsync: SSL status:%d\n", status);

    switch (status) {
    case LM_SSL_STATUS_NO_CERT_FOUND:
        g_printerr ("LmSendAsync: No certificate found!\n");
        break;
    case LM_SSL_STATUS_UNTRUSTED_CERT:
        g_printerr ("LmSendAsync: Certificate is not trusted!\n"); 
        break;
    case LM_SSL_STATUS_CERT_EXPIRED:
        g_printerr ("LmSendAsync: Certificate has expired!\n"); 
        break;
    case LM_SSL_STATUS_CERT_NOT_ACTIVATED:
        g_printerr ("LmSendAsync: Certificate has not been activated!\n"); 
        break;
    case LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH:
        g_printerr ("LmSendAsync: Certificate hostname does not match expected hostname!\n"); 
        break;
    case LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH: {
        const char *fpr = lm_ssl_get_fingerprint (ssl);
        g_printerr ("LmSendAsync: Certificate fingerprint does not match expected fingerprint!\n"); 
        g_printerr ("LmSendAsync: Remote fingerprint: ");
        print_finger (fpr, 16);

        g_printerr ("\n"
                    "LmSendAsync: Expected fingerprint: ");
        print_finger (expected_fingerprint, 16);
        g_printerr ("\n");
        break;
    }
    case LM_SSL_STATUS_GENERIC_ERROR:
        g_printerr ("LmSendAsync: Generic SSL error!\n"); 
        break;
    }

    return LM_SSL_RESPONSE_CONTINUE;
}
Example #3
0
int main() {

  // setup
  struct leap_event *event;
  struct leap_controller *controller = leap_controller();
  struct leap_listener *listener = leap_listener(1000);
  leap_add_listener(controller, listener);

  // poll for events until we get 5000
  int limit = 5000;
  int counter = 0;
  int i, j;
  while (counter < limit) {
    while ((event = leap_poll_listener(listener)) != NULL) {
      printf("New event (%d): Type: %d\n", counter, event->event_code);
      print_frame(&event->frame);
      print_bounds(&event->frame.bounds);
      for (i = 0; i < event->frame.hand_count; i++) {
        struct leap_hand *hand = &event->frame.hands[i];
        print_hand(hand);
        for (j = 0; j < hand->finger_count; ++j) {
          struct leap_finger *finger = &hand->fingers[j];
          print_finger(finger);
        }
      }

      ++counter;
      if (counter > limit)
        break;
    }
    sleep_(100);
  }

  // shutdown
  leap_remove_listener(controller, listener);
  leap_listener_dispose(listener);
  leap_controller_dispose(controller);
}