agent.h 1.72 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

Dafydd Harries's avatar
Dafydd Harries committed
11
G_BEGIN_DECLS
12

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

15 16 17 18
typedef void (*NiceAgentRecvFunc) (
  NiceAgent *agent, guint stream_id, guint component_id, guint len,
  gchar *buf, gpointer user_data);

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
  GSList *streams;
28 29 30 31
  gboolean main_context_set;
  GMainContext *main_context;
  NiceAgentRecvFunc read_func;
  gpointer read_func_data;
Dafydd Harries's avatar
Dafydd Harries committed
32 33
};

34
NiceAgent *
Dafydd Harries's avatar
Dafydd Harries committed
35
nice_agent_new (NiceUDPSocketFactory *factory);
36

Dafydd Harries's avatar
Dafydd Harries committed
37
void
38
nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr);
39

Dafydd Harries's avatar
Dafydd Harries committed
40
guint
41 42
nice_agent_add_stream (
  NiceAgent *agent,
43
  guint n_components);
44

Dafydd Harries's avatar
Dafydd Harries committed
45 46 47 48 49
void
nice_agent_remove_stream (
  NiceAgent *agent,
  guint stream_id);

Dafydd Harries's avatar
Dafydd Harries committed
50
void
51
nice_agent_free (NiceAgent *agent);
52

53
void
54 55
nice_agent_add_remote_candidate (
  NiceAgent *agent,
56 57
  guint stream_id,
  guint component_id,
58 59
  NiceCandidateType type,
  NiceAddress *addr,
60 61
  const gchar *username,
  const gchar *password);
62

Dafydd Harries's avatar
Dafydd Harries committed
63
guint
64
nice_agent_recv (
Dafydd Harries's avatar
Dafydd Harries committed
65 66 67 68 69 70
  NiceAgent *agent,
  guint stream_id,
  guint component_id,
  guint buf_len,
  gchar *buf);

Dafydd Harries's avatar
Dafydd Harries committed
71 72 73
GSList *
nice_agent_poll_read (
  NiceAgent *agent,
74 75 76
  GSList *other_fds,
  NiceAgentRecvFunc func,
  gpointer data);
Dafydd Harries's avatar
Dafydd Harries committed
77

Dafydd Harries's avatar
Dafydd Harries committed
78 79 80 81 82 83
void
nice_agent_send (
  NiceAgent *agent,
  guint stream_id,
  guint component_id,
  guint len,
84
  const gchar *buf);
Dafydd Harries's avatar
Dafydd Harries committed
85

86
const GSList *
87 88
nice_agent_get_local_candidates (
  NiceAgent *agent);
Dafydd Harries's avatar
Dafydd Harries committed
89

90 91 92 93 94 95 96
gboolean
nice_agent_main_context_attach (
  NiceAgent *agent,
  GMainContext *ctx,
  NiceAgentRecvFunc func,
  gpointer data);

Dafydd Harries's avatar
Dafydd Harries committed
97 98
G_END_DECLS

Dafydd Harries's avatar
Dafydd Harries committed
99 100
#endif /* _AGENT_H */