Commit f7c9758b authored by Dafydd Harries's avatar Dafydd Harries

split out event code; add "nice" prefix; add _ prefix to nice_event_new

darcs-hash:20070202105516-c9803-2cba259efc37ed98ecf7f6b946dcc6085e30c972.gz
parent 6a558afb
......@@ -15,7 +15,9 @@ libagent_la_SOURCES = \
candidate.h \
candidate.c \
agent.h \
agent.c
agent.c \
event.h \
event.c
libagent_la_LIBADD = \
$(top_builddir)/random/librandom.la \
......
......@@ -139,35 +139,6 @@ candidate_pair_priority (
}
/*** event ***/
#if 0
static Event *
nice_event_new (EventType type)
{
Event *ev;
ev = g_slice_new0 (Event);
ev->type = type;
return ev;
}
#endif
void
nice_event_free (Event *ev)
{
switch (ev->type)
{
case EVENT_CANDIDATE_SELECTED:
break;
}
g_slice_free (Event, ev);
}
/*** agent ***/
......@@ -191,10 +162,10 @@ nice_agent_new (NiceUDPSocketFactory *factory)
}
Event *
NiceEvent *
nice_agent_pop_event (NiceAgent *agent)
{
Event *event;
NiceEvent *event;
GSList *head;
if (agent->events == NULL)
......
......@@ -9,48 +9,10 @@
#include "udp.h"
#include "address.h"
#include "candidate.h"
#include "event.h"
G_BEGIN_DECLS
/*** event ***/
typedef enum _EventType EventType;
enum _EventType
{
EVENT_CANDIDATE_SELECTED,
};
typedef struct _Event Event;
struct _Event
{
EventType type;
union {
struct {
NiceAddress *addr;
guint candidate_id;
} request_port;
struct {
NiceAddress *from;
guint from_port;
NiceAddress *to;
guint to_port;
} request_stun_query;
};
};
void
event_free (Event *ev);
/*** agent ***/
typedef struct _NiceAgent NiceAgent;
struct _NiceAgent
......@@ -74,7 +36,7 @@ typedef void (*NiceAgentRecvHandler) (
NiceAgent *
nice_agent_new (NiceUDPSocketFactory *factory);
Event *
NiceEvent *
nice_agent_pop_event (NiceAgent *agent);
void
......
#include "address.h"
#include "event.h"
NiceEvent *
_nice_event_new (NiceEventType type)
{
NiceEvent *ev;
ev = g_slice_new0 (NiceEvent);
ev->type = type;
return ev;
}
void
nice_event_free (NiceEvent *ev)
{
switch (ev->type)
{
case EVENT_CANDIDATE_SELECTED:
break;
}
g_slice_free (NiceEvent, ev);
}
#ifndef _EVENT_H
#define _EVENT_H
#include <glib.h>
G_BEGIN_DECLS
typedef enum _NiceEventType NiceEventType;
enum _NiceEventType
{
EVENT_CANDIDATE_SELECTED,
};
typedef struct _NiceEvent NiceEvent;
struct _NiceEvent
{
NiceEventType type;
union {
struct {
NiceAddress *addr;
guint candidate_id;
} request_port;
struct {
NiceAddress *from;
guint from_port;
NiceAddress *to;
guint to_port;
} request_stun_query;
};
};
NiceEvent *
_nice_event_new (NiceEventType type);
void
nice_event_free (NiceEvent *ev);
G_END_DECLS
#endif /* _EVENT_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment