agent.h 1.41 KB
Newer Older
Dafydd Harries's avatar
Dafydd Harries committed
1 2 3 4

#ifndef _AGENT_H
#define _AGENT_H

5
#include <arpa/inet.h>
6

7 8 9
#include <glib.h>

#include "udp.h"
10
#include "address.h"
Dafydd Harries's avatar
Dafydd Harries committed
11
#include "candidate.h"
12
#include "event.h"
13

Dafydd Harries's avatar
Dafydd Harries committed
14
G_BEGIN_DECLS
15

16
typedef struct _NiceAgent NiceAgent;
Dafydd Harries's avatar
Dafydd Harries committed
17

18 19 20
typedef void (*NiceAgentEventFunc) (
  NiceAgent *agent, NiceEvent *event);

21
struct _NiceAgent
Dafydd Harries's avatar
Dafydd Harries committed
22 23
{
  guint next_candidate_id;
Dafydd Harries's avatar
Dafydd Harries committed
24
  guint next_stream_id;
Dafydd Harries's avatar
Dafydd Harries committed
25
  NiceUDPSocketFactory *socket_factory;
Dafydd Harries's avatar
Dafydd Harries committed
26 27
  GSList *local_addresses;
  GSList *local_candidates;
28
  GSList *remote_candidates;
Dafydd Harries's avatar
Dafydd Harries committed
29 30 31 32 33
  GSList *streams;
  GSList *events;
};


34
typedef void (*NiceAgentRecvFunc) (
35
  NiceAgent *agent, guint stream_id, guint component_id, guint len,
36
  gchar *buf, gpointer user_data);
37 38


39
NiceAgent *
Dafydd Harries's avatar
Dafydd Harries committed
40
nice_agent_new (NiceUDPSocketFactory *factory);
41

42
NiceEvent *
43
nice_agent_pop_event (NiceAgent *agent);
44

Dafydd Harries's avatar
Dafydd Harries committed
45
void
46
nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr);
47

Dafydd Harries's avatar
Dafydd Harries committed
48
guint
49 50
nice_agent_add_stream (
  NiceAgent *agent,
51
  NiceAgentRecvFunc recv_func,
52
  gpointer handle_recv_data);
53

Dafydd Harries's avatar
Dafydd Harries committed
54
void
55
nice_agent_free (NiceAgent *agent);
56

57
void
58 59
nice_agent_add_remote_candidate (
  NiceAgent *agent,
60 61
  guint stream_id,
  guint component_id,
62 63
  NiceCandidateType type,
  NiceAddress *addr,
64 65
  gchar *username,
  gchar *password);
66

Dafydd Harries's avatar
Dafydd Harries committed
67
void
68 69
nice_agent_recv (
  NiceAgent *agent,
Dafydd Harries's avatar
Dafydd Harries committed
70
  guint candidate_id);
71

Dafydd Harries's avatar
Dafydd Harries committed
72 73 74 75 76
GSList *
nice_agent_poll_read (
  NiceAgent *agent,
  GSList *other_fds);

77
const GSList *
78 79
nice_agent_get_local_candidates (
  NiceAgent *agent);
Dafydd Harries's avatar
Dafydd Harries committed
80

Dafydd Harries's avatar
Dafydd Harries committed
81 82
G_END_DECLS

Dafydd Harries's avatar
Dafydd Harries committed
83 84
#endif /* _AGENT_H */