test_agent.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "agent.h"
  5. #include "ports.h"
  6. void test_gather_host(Agent* agent) {
  7. agent_gather_candidate(agent, NULL, NULL, NULL);
  8. }
  9. void test_gather_turn(Agent* agent, char* turnserver, char* username, char* credential) {
  10. agent_gather_candidate(agent, turnserver, username, credential);
  11. }
  12. void test_gather_stun(Agent* agent, char* stunserver) {
  13. agent_gather_candidate(agent, stunserver, NULL, NULL);
  14. }
  15. int main(int argc, char* argv[]) {
  16. Agent agent;
  17. char stunserver[] = "stun:stun.l.google.com:19302";
  18. char turnserver[] = "";
  19. char username[] = "";
  20. char credential[] = "";
  21. char description[1024];
  22. memset(&description, 0, sizeof(description));
  23. agent_create(&agent);
  24. test_gather_host(&agent);
  25. test_gather_stun(&agent, stunserver);
  26. test_gather_turn(&agent, turnserver, username, credential);
  27. agent_get_local_description(&agent, description, sizeof(description));
  28. printf("sdp:\n%s\n", description);
  29. agent_destroy(&agent);
  30. return 0;
  31. }