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

#ifndef _AGENT_H
#define _AGENT_H

5 6 7
#include <glib.h>

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

Dafydd Harries's avatar
Dafydd Harries committed
12
G_BEGIN_DECLS
13

14
typedef struct _NiceAgent NiceAgent;
Dafydd Harries's avatar
Dafydd Harries committed
15

16 17 18
typedef void (*NiceAgentEventFunc) (
  NiceAgent *agent, NiceEvent *event);

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


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


37
NiceAgent *
Dafydd Harries's avatar
Dafydd Harries committed
38
nice_agent_new (NiceUDPSocketFactory *factory);
39

Dafydd Harries's avatar
Dafydd Harries committed
40
void
41
nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr);
42

Dafydd Harries's avatar
Dafydd Harries committed
43
guint
44 45
nice_agent_add_stream (
  NiceAgent *agent,
46
  NiceAgentRecvFunc recv_func,
47
  gpointer handle_recv_data);
48

Dafydd Harries's avatar
Dafydd Harries committed
49 50 51 52 53
void
nice_agent_remove_stream (
  NiceAgent *agent,
  guint stream_id);

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
guint
68
nice_agent_recv (
Dafydd Harries's avatar
Dafydd Harries committed
69 70 71 72 73 74
  NiceAgent *agent,
  guint stream_id,
  guint component_id,
  guint buf_len,
  gchar *buf);

Dafydd Harries's avatar
Dafydd Harries committed
75 76 77
GSList *
nice_agent_poll_read (
  NiceAgent *agent,
78 79 80
  GSList *other_fds,
  NiceAgentRecvFunc func,
  gpointer data);
Dafydd Harries's avatar
Dafydd Harries committed
81

Dafydd Harries's avatar
Dafydd Harries committed
82 83 84 85 86 87 88 89
void
nice_agent_send (
  NiceAgent *agent,
  guint stream_id,
  guint component_id,
  guint len,
  gchar *buf);

90
const GSList *
91 92
nice_agent_get_local_candidates (
  NiceAgent *agent);
Dafydd Harries's avatar
Dafydd Harries committed
93

Dafydd Harries's avatar
Dafydd Harries committed
94 95
G_END_DECLS

Dafydd Harries's avatar
Dafydd Harries committed
96 97
#endif /* _AGENT_H */