Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
01a9222f
Commit
01a9222f
authored
Jan 26, 2013
by
Danilo Sabato
Committed by
Alessandro Rubini
Feb 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arch-bare-linux: added net_init + net_shutdown, fixed pp_send_packet to fit the prototype
parent
d82981ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
bare-socket.c
arch-bare-linux/bare-socket.c
+36
-2
No files found.
arch-bare-linux/bare-socket.c
View file @
01a9222f
...
...
@@ -7,6 +7,9 @@
#include <ppsi/diag.h>
#include "bare-linux.h"
/* 14 is ppi->proto_ofst for ethernet mode */
Octet
buffer_out
[
PP_PACKET_SIZE
+
14
];
/* FIXME: which socket we receive and send with? */
int
bare_recv_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
TimeInternal
*
t
)
...
...
@@ -22,10 +25,14 @@ int bare_send_packet(struct pp_instance *ppi, void *pkt, int len, int chtype,
int
pp_recv_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
TimeInternal
*
t
)
__attribute__
((
alias
(
"bare_recv_packet"
)));
int
pp_send_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
int
chtype
,
int
use_pdelay_addr
)
int
pp_send_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
TimeInternal
*
t
,
int
chtype
,
int
use_pdelay_addr
)
__attribute__
((
alias
(
"bare_send_packet"
)));
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#define PF_PACKET 17
#define SOCK_RAW 3
...
...
@@ -75,3 +82,30 @@ int bare_open_ch(struct pp_instance *ppi, char *ifname)
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
=
sock
;
return
0
;
}
int
bare_net_init
(
struct
pp_instance
*
ppi
)
{
ppi
->
buf_out
=
buffer_out
;
ppi
->
buf_out
=
PROTO_PAYLOAD
(
ppi
->
buf_out
);
if
(
OPTS
(
ppi
)
->
ethernet_mode
)
{
PP_PRINTF
(
"bare_net_init IEEE 802.3
\n
"
);
/* raw sockets implementation always use gen socket */
return
bare_open_ch
(
ppi
,
OPTS
(
ppi
)
->
iface_name
);
}
/* else: UDP */
PP_PRINTF
(
"bare_net_init UDP
\n
"
);
return
0
;
}
int
pp_net_init
(
struct
pp_instance
*
ppi
)
__attribute__
((
alias
(
"bare_net_init"
)));
int
bare_net_shutdown
(
struct
pp_instance
*
ppi
)
{
return
sys_shutdown
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
SHUT_RDWR
);
}
int
pp_net_shutdown
(
struct
pp_instance
*
ppi
)
__attribute__
((
alias
(
"bare_net_shutdown"
)));
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