agent.h 1.59 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
  guint n_components);
47

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

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

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

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

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

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

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

Dafydd Harries's avatar
Dafydd Harries committed
93 94
G_END_DECLS

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