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 20 21 22
typedef void (*NiceAgentRecvFunc) (
  NiceAgent *agent, guint stream_id, guint component_id, guint len,
  gchar *buf, gpointer user_data);

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

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

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

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

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

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

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

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

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

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

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

Dafydd Harries's avatar
Dafydd Harries committed
91 92
G_END_DECLS

Dafydd Harries's avatar
Dafydd Harries committed
93 94
#endif /* _AGENT_H */