agent.h 1.5 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
void
50
nice_agent_free (NiceAgent *agent);
51

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

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

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

Dafydd Harries's avatar
Dafydd Harries committed
75 76 77 78 79 80 81 82
void
nice_agent_send (
  NiceAgent *agent,
  guint stream_id,
  guint component_id,
  guint len,
  gchar *buf);

83
const GSList *
84 85
nice_agent_get_local_candidates (
  NiceAgent *agent);
Dafydd Harries's avatar
Dafydd Harries committed
86

Dafydd Harries's avatar
Dafydd Harries committed
87 88
G_END_DECLS

Dafydd Harries's avatar
Dafydd Harries committed
89 90
#endif /* _AGENT_H */