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
47
Issues
47
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
2e755840
Commit
2e755840
authored
Jan 16, 2012
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
defined and used NP macro as ppi->net_path shortcut
parent
5ad45baf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
32 deletions
+33
-32
bare-socket.c
arch-bare-linux/bare-socket.c
+6
-6
main-loop.c
arch-bare-linux/main-loop.c
+5
-5
posix-socket.c
arch-gnu-linux/posix-socket.c
+19
-19
spec-socket.c
arch-spec/spec-socket.c
+2
-2
pptp.h
include/pptp/pptp.h
+1
-0
No files found.
arch-bare-linux/bare-socket.c
View file @
2e755840
...
...
@@ -10,12 +10,12 @@
/* FIXME: which socket we receive and send with? */
int
bare_recv_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
)
{
return
sys_recv
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
,
pkt
,
len
,
0
);
return
sys_recv
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
pkt
,
len
,
0
);
}
int
bare_send_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
int
chtype
)
{
return
sys_send
(
ppi
->
net_path
->
ch
[
chtype
].
fd
,
pkt
,
len
,
0
);
return
sys_send
(
NP
(
ppi
)
->
ch
[
chtype
].
fd
,
pkt
,
len
,
0
);
}
int
pp_recv_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
)
...
...
@@ -53,9 +53,9 @@ int bare_open_ch(struct pp_instance *ppi, char *ifname)
pp_diag_error
(
ppi
,
bare_errno
);
pp_diag_fatal
(
ppi
,
"ioctl(GIFHWADDR)"
,
""
);
}
memcpy
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
addr
,
memcpy
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
addr
,
ifr
.
ifr_ifru
.
ifru_hwaddr
.
sa_data
,
6
);
memcpy
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
addr
,
memcpy
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
addr
,
ifr
.
ifr_ifru
.
ifru_hwaddr
.
sa_data
,
6
);
/* bind and setsockopt */
...
...
@@ -68,7 +68,7 @@ int bare_open_ch(struct pp_instance *ppi, char *ifname)
pp_diag_fatal
(
ppi
,
"bind"
,
""
);
}
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
=
sock
;
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
=
sock
;
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
=
sock
;
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
=
sock
;
return
0
;
}
arch-bare-linux/main-loop.c
View file @
2e755840
...
...
@@ -46,11 +46,11 @@ void bare_main_loop(struct pp_instance *ppi)
again:
FD_ZERO
(
&
set
);
FD_SET
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
,
&
set
);
FD_SET
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
,
&
set
);
maxfd
=
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
;
if
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
>
maxfd
)
maxfd
=
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
;
FD_SET
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
&
set
);
FD_SET
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
,
&
set
);
maxfd
=
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
;
if
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
>
maxfd
)
maxfd
=
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
;
i
=
sys_select
(
maxfd
+
1
,
&
set
,
NULL
,
NULL
,
&
tv
);
if
(
i
<
0
&&
bare_errno
!=
4
/* EINTR */
)
...
...
arch-gnu-linux/posix-socket.c
View file @
2e755840
...
...
@@ -29,12 +29,12 @@ int posix_recv_packet(struct pp_instance *ppi, void *pkt, int len)
/* TODO: rewrite it in a better way! */
switch
(
ch_check_stat
)
{
case
0
:
ch1
=
&
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
]);
ch2
=
&
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
]);
ch1
=
&
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
]);
ch2
=
&
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
]);
break
;
case
1
:
ch1
=
&
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
]);
ch2
=
&
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
]);
ch1
=
&
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
]);
ch2
=
&
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
]);
break
;
default:
/* Impossible! */
...
...
@@ -53,7 +53,7 @@ int posix_recv_packet(struct pp_instance *ppi, void *pkt, int len)
int
posix_send_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
int
chtype
)
{
return
send
(
ppi
->
net_path
->
ch
[
chtype
].
fd
,
pkt
,
len
,
0
);
return
send
(
NP
(
ppi
)
->
ch
[
chtype
].
fd
,
pkt
,
len
,
0
);
}
int
pp_recv_packet
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
)
...
...
@@ -99,8 +99,8 @@ int posix_open_ch(struct pp_instance *ppi, char *ifname)
return
-
1
;
}
/* FIXME: what to do with hw address */
memcpy
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
addr
,
ifr
.
ifr_hwaddr
.
sa_data
,
6
);
memcpy
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
addr
,
ifr
.
ifr_hwaddr
.
sa_data
,
6
);
memcpy
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
addr
,
ifr
.
ifr_hwaddr
.
sa_data
,
6
);
memcpy
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
addr
,
ifr
.
ifr_hwaddr
.
sa_data
,
6
);
/* bind and setsockopt */
memset
(
&
addr
,
0
,
sizeof
(
addr
));
...
...
@@ -113,8 +113,8 @@ int posix_open_ch(struct pp_instance *ppi, char *ifname)
return
-
1
;
}
/* FIXME: we are using the same socket for both channels by now */
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
=
sock
;
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
=
sock
;
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
=
sock
;
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
=
sock
;
return
0
;
}
...
...
@@ -164,14 +164,14 @@ int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms)
arch_data
->
tv
.
tv_usec
=
(
delay_ms
%
1000
)
*
1000
;
}
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
pkt_present
=
0
;
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
pkt_present
=
0
;
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
pkt_present
=
0
;
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
pkt_present
=
0
;
maxfd
=
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
>
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
)
?
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
:
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
;
maxfd
=
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
>
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
)
?
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
:
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
;
FD_ZERO
(
&
set
);
FD_SET
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
,
&
set
);
FD_SET
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
,
&
set
);
FD_SET
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
&
set
);
FD_SET
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
,
&
set
);
i
=
select
(
maxfd
+
1
,
&
set
,
NULL
,
NULL
,
&
arch_data
->
tv
);
if
(
i
<
0
&&
errno
!=
EINTR
)
...
...
@@ -185,14 +185,14 @@ int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms)
if
(
i
==
0
)
goto
_end
;
if
(
FD_ISSET
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
fd
,
&
set
))
{
if
(
FD_ISSET
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
&
set
))
{
ret
++
;
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
pkt_present
=
1
;
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
pkt_present
=
1
;
}
if
(
FD_ISSET
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
fd
,
&
set
))
{
if
(
FD_ISSET
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
fd
,
&
set
))
{
ret
++
;
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
pkt_present
=
1
;
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
pkt_present
=
1
;
}
_end:
...
...
arch-spec/spec-socket.c
View file @
2e755840
...
...
@@ -16,8 +16,8 @@ int spec_open_ch(struct pp_instance *ppi)
ep_enable
(
1
,
1
);
minic_init
();
memcpy
(
ppi
->
net_path
->
ch
[
PP_NP_GEN
].
addr
,
fake_addr
,
6
);
memcpy
(
ppi
->
net_path
->
ch
[
PP_NP_EVT
].
addr
,
fake_addr
,
6
);
memcpy
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
addr
,
fake_addr
,
6
);
memcpy
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
addr
,
fake_addr
,
6
);
return
0
;
}
...
...
include/pptp/pptp.h
View file @
2e755840
...
...
@@ -175,6 +175,7 @@ struct pp_instance {
#define DSPOR(x) ((x)->portDS)
#define DSPRO(x) ((x)->timePropertiesDS)
#define NP(x) ((x)->net_path)
/* The channel for an instance must be created and possibly destroyed. */
extern
int
pp_open_instance
(
struct
pp_instance
*
ppi
,
...
...
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