Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
e048732f
Commit
e048732f
authored
Oct 06, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update udp socket layers to new NiceSocket API
parent
a972e826
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
42 deletions
+42
-42
socket/udp-bsd.c
socket/udp-bsd.c
+9
-9
socket/udp-bsd.h
socket/udp-bsd.h
+2
-2
socket/udp-turn.c
socket/udp-turn.c
+21
-21
socket/udp-turn.h
socket/udp-turn.h
+10
-10
No files found.
socket/udp-bsd.c
View file @
e048732f
...
...
@@ -54,7 +54,7 @@
#include "udp-bsd.h"
/*** Nice
UDP
Socket ***/
/*** NiceSocket ***/
static
int
sock_recv_err
(
int
fd
)
{
#ifdef MSG_ERRQUEUE
...
...
@@ -74,7 +74,7 @@ static int sock_recv_err (int fd)
static
gint
socket_recv
(
Nice
UDP
Socket
*
sock
,
NiceSocket
*
sock
,
NiceAddress
*
from
,
guint
len
,
gchar
*
buf
)
...
...
@@ -97,7 +97,7 @@ socket_recv (
static
gboolean
socket_send
(
Nice
UDP
Socket
*
sock
,
NiceSocket
*
sock
,
const
NiceAddress
*
to
,
guint
len
,
const
gchar
*
buf
)
...
...
@@ -116,18 +116,18 @@ socket_send (
}
static
void
socket_close
(
Nice
UDP
Socket
*
sock
)
socket_close
(
NiceSocket
*
sock
)
{
close
(
sock
->
fileno
);
}
/*** Nice
UDP
SocketFactory ***/
/*** NiceSocketFactory ***/
static
gboolean
socket_factory_init_socket
(
G_GNUC_UNUSED
Nice
UDP
SocketFactory
*
man
,
Nice
UDP
Socket
*
sock
,
NiceSocketFactory
*
man
,
NiceSocket
*
sock
,
NiceAddress
*
addr
)
{
int
sockfd
=
-
1
;
...
...
@@ -228,7 +228,7 @@ socket_factory_init_socket (
static
void
socket_factory_close
(
G_GNUC_UNUSED
Nice
UDP
SocketFactory
*
man
)
NiceSocketFactory
*
man
)
{
(
void
)
man
;
}
...
...
@@ -236,7 +236,7 @@ socket_factory_close (
NICEAPI_EXPORT
void
nice_udp_bsd_socket_factory_init
(
G_GNUC_UNUSED
Nice
UDP
SocketFactory
*
man
)
NiceSocketFactory
*
man
)
{
man
->
init
=
socket_factory_init_socket
;
man
->
close
=
socket_factory_close
;
...
...
socket/udp-bsd.h
View file @
e048732f
...
...
@@ -38,12 +38,12 @@
#ifndef _UDP_BSD_H
#define _UDP_BSD_H
#include "
udp
.h"
#include "
socket
.h"
G_BEGIN_DECLS
void
nice_udp_bsd_socket_factory_init
(
Nice
UDP
SocketFactory
*
man
);
nice_udp_bsd_socket_factory_init
(
NiceSocketFactory
*
man
);
G_END_DECLS
...
...
socket/udp-turn.c
View file @
e048732f
...
...
@@ -75,7 +75,7 @@ typedef struct {
GList
*
channels
;
GList
*
retransmissions
;
ChannelBinding
*
current_binding
;
Nice
UDPSocket
*
udp
_socket
;
Nice
Socket
*
base
_socket
;
NiceAddress
server_addr
;
uint8_t
*
username
;
size_t
username_len
;
...
...
@@ -148,7 +148,7 @@ priv_send_channel_bind (turn_priv *priv, StunMessage *resp,
priv
->
password
,
priv
->
password_len
);
if
(
stun_len
>
0
)
{
nice_
udp_socket_send
(
priv
->
udp
_socket
,
&
priv
->
server_addr
,
nice_
socket_send
(
priv
->
base
_socket
,
&
priv
->
server_addr
,
stun_len
,
(
gchar
*
)
buffer
);
return
TRUE
;
}
...
...
@@ -156,7 +156,7 @@ priv_send_channel_bind (turn_priv *priv, StunMessage *resp,
return
FALSE
;
}
NICEAPI_EXPORT
gboolean
nice_udp_turn_socket_set_peer
(
Nice
UDP
Socket
*
sock
,
NiceAddress
*
peer
)
nice_udp_turn_socket_set_peer
(
NiceSocket
*
sock
,
NiceAddress
*
peer
)
{
turn_priv
*
priv
=
(
turn_priv
*
)
sock
->
priv
;
StunMessage
msg
;
...
...
@@ -217,7 +217,7 @@ nice_udp_turn_socket_set_peer (NiceUDPSocket *sock, NiceAddress *peer)
priv
->
current_binding
=
g_new0
(
ChannelBinding
,
1
);
priv
->
current_binding
->
channel
=
0
;
priv
->
current_binding
->
peer
=
*
peer
;
nice_
udp_socket_send
(
priv
->
udp
_socket
,
&
priv
->
server_addr
,
nice_
socket_send
(
priv
->
base
_socket
,
&
priv
->
server_addr
,
stun_len
,
(
gchar
*
)
buffer
);
}
return
TRUE
;
...
...
@@ -236,7 +236,7 @@ nice_udp_turn_socket_set_peer (NiceUDPSocket *sock, NiceAddress *peer)
gint
nice_udp_turn_socket_parse_recv
(
Nice
UDP
Socket
*
sock
,
NiceSocket
*
sock
,
NiceAddress
*
from
,
guint
len
,
gchar
*
buf
,
...
...
@@ -366,7 +366,7 @@ nice_udp_turn_socket_parse_recv (
static
gint
socket_recv
(
Nice
UDP
Socket
*
sock
,
NiceSocket
*
sock
,
NiceAddress
*
from
,
guint
len
,
gchar
*
buf
)
...
...
@@ -376,7 +376,7 @@ socket_recv (
gint
recv_len
;
NiceAddress
recv_from
;
recv_len
=
nice_
udp_socket_recv
(
priv
->
udp
_socket
,
&
recv_from
,
recv_len
=
nice_
socket_recv
(
priv
->
base
_socket
,
&
recv_from
,
sizeof
(
recv_buf
),
(
gchar
*
)
recv_buf
);
return
nice_udp_turn_socket_parse_recv
(
sock
,
from
,
len
,
buf
,
&
recv_from
,
...
...
@@ -385,7 +385,7 @@ socket_recv (
static
gboolean
socket_send
(
Nice
UDP
Socket
*
sock
,
NiceSocket
*
sock
,
const
NiceAddress
*
to
,
guint
len
,
const
gchar
*
buf
)
...
...
@@ -460,18 +460,18 @@ socket_send (
}
if
(
msg_len
>
0
)
{
nice_
udp_socket_send
(
priv
->
udp
_socket
,
&
priv
->
server_addr
,
nice_
socket_send
(
priv
->
base
_socket
,
&
priv
->
server_addr
,
msg_len
,
(
gchar
*
)
buffer
);
return
TRUE
;
}
send:
nice_
udp_socket_send
(
priv
->
udp
_socket
,
to
,
len
,
buf
);
nice_
socket_send
(
priv
->
base
_socket
,
to
,
len
,
buf
);
return
TRUE
;
}
static
void
socket_close
(
Nice
UDP
Socket
*
sock
)
socket_close
(
NiceSocket
*
sock
)
{
turn_priv
*
priv
=
(
turn_priv
*
)
sock
->
priv
;
GList
*
i
=
priv
->
channels
;
...
...
@@ -485,12 +485,12 @@ socket_close (NiceUDPSocket *sock)
g_free
(
priv
);
}
/*** Nice
UDP
SocketFactory ***/
/*** NiceSocketFactory ***/
static
gboolean
socket_factory_init_socket
(
Nice
UDP
SocketFactory
*
man
,
Nice
UDP
Socket
*
sock
,
NiceSocketFactory
*
man
,
NiceSocket
*
sock
,
NiceAddress
*
addr
)
{
return
FALSE
;
...
...
@@ -498,10 +498,10 @@ socket_factory_init_socket (
NICEAPI_EXPORT
gboolean
nice_udp_turn_create_socket_full
(
Nice
UDP
SocketFactory
*
man
,
Nice
UDP
Socket
*
sock
,
NiceSocketFactory
*
man
,
NiceSocket
*
sock
,
NiceAddress
*
addr
,
Nice
UDPSocket
*
udp
_socket
,
Nice
Socket
*
base
_socket
,
NiceAddress
*
server_addr
,
gchar
*
username
,
gchar
*
password
,
...
...
@@ -527,7 +527,7 @@ nice_udp_turn_create_socket_full (
priv
->
channels
=
NULL
;
priv
->
current_binding
=
NULL
;
priv
->
udp_socket
=
udp
_socket
;
priv
->
base_socket
=
base
_socket
;
if
(
compatibility
==
NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN
)
{
priv
->
username
=
g_base64_decode
(
username
,
&
priv
->
username_len
);
...
...
@@ -546,7 +546,7 @@ nice_udp_turn_create_socket_full (
priv
->
server_addr
=
*
server_addr
;
priv
->
compatibility
=
compatibility
;
sock
->
addr
=
*
addr
;
sock
->
fileno
=
udp
_socket
->
fileno
;
sock
->
fileno
=
base
_socket
->
fileno
;
sock
->
send
=
socket_send
;
sock
->
recv
=
socket_recv
;
sock
->
close
=
socket_close
;
...
...
@@ -557,14 +557,14 @@ nice_udp_turn_create_socket_full (
static
void
socket_factory_close
(
G_GNUC_UNUSED
Nice
UDP
SocketFactory
*
man
)
NiceSocketFactory
*
man
)
{
}
NICEAPI_EXPORT
void
nice_udp_turn_socket_factory_init
(
G_GNUC_UNUSED
Nice
UDP
SocketFactory
*
man
)
NiceSocketFactory
*
man
)
{
man
->
init
=
socket_factory_init_socket
;
...
...
socket/udp-turn.h
View file @
e048732f
...
...
@@ -35,10 +35,10 @@
* file under either the MPL or the LGPL.
*/
#ifndef _
GOOGLE_RELAY
_H
#define _
GOOGLE_RELAY
_H
#ifndef _
UDP_TURN
_H
#define _
UDP_TURN
_H
#include "
udp
.h"
#include "
socket
.h"
G_BEGIN_DECLS
...
...
@@ -50,7 +50,7 @@ typedef enum {
gint
nice_udp_turn_socket_parse_recv
(
Nice
UDP
Socket
*
sock
,
NiceSocket
*
sock
,
NiceAddress
*
from
,
guint
len
,
gchar
*
buf
,
...
...
@@ -59,14 +59,14 @@ nice_udp_turn_socket_parse_recv (
guint
recv_len
);
gboolean
nice_udp_turn_socket_set_peer
(
Nice
UDP
Socket
*
sock
,
NiceAddress
*
peer
);
nice_udp_turn_socket_set_peer
(
NiceSocket
*
sock
,
NiceAddress
*
peer
);
gboolean
nice_udp_turn_create_socket_full
(
Nice
UDP
SocketFactory
*
man
,
Nice
UDP
Socket
*
sock
,
NiceSocketFactory
*
man
,
NiceSocket
*
sock
,
NiceAddress
*
addr
,
Nice
UDP
Socket
*
udp_socket
,
NiceSocket
*
udp_socket
,
NiceAddress
*
server_addr
,
gchar
*
username
,
gchar
*
password
,
...
...
@@ -74,9 +74,9 @@ nice_udp_turn_create_socket_full (
void
nice_udp_turn_socket_factory_init
(
Nice
UDP
SocketFactory
*
man
);
nice_udp_turn_socket_factory_init
(
NiceSocketFactory
*
man
);
G_END_DECLS
#endif
/* _UDP_
BSD
_H */
#endif
/* _UDP_
TURN
_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment