Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Limkilde Svendsen
relibc
Commits
e688d9c4
Commit
e688d9c4
authored
6 years ago
by
TheDarkula
Browse files
Options
Downloads
Patches
Plain Diff
Updated url, implemented missing functions in header/arpa_inet/mod.rs
parent
50c03f28
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/header/arpa_inet/mod.rs
+51
-16
51 additions, 16 deletions
src/header/arpa_inet/mod.rs
with
51 additions
and
16 deletions
src/header/arpa_inet/mod.rs
+
51
−
16
View file @
e688d9c4
//! arpa/inet implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xs
h
/arpainet.h.html
//! arpa/inet implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/x
n
s/arpainet.h.html
use
core
::
str
::
FromStr
;
use
core
::
str
::
FromStr
;
use
core
::{
ptr
,
slice
,
str
};
use
core
::{
ptr
,
slice
,
str
};
use
header
::
errno
::
*
;
use
header
::
errno
::
*
;
use
header
::
netinet_in
::{
in_addr
,
in_addr_t
};
use
header
::
netinet_in
::{
in_addr
,
in_addr_t
,
INADDR_NONE
};
use
header
::
sys_socket
::
constants
::
*
;
use
header
::
sys_socket
::
constants
::
*
;
use
header
::
sys_socket
::
socklen_t
;
use
header
::
sys_socket
::
socklen_t
;
use
platform
;
use
platform
;
...
@@ -99,27 +99,62 @@ pub unsafe extern "C" fn inet_ntop(
...
@@ -99,27 +99,62 @@ pub unsafe extern "C" fn inet_ntop(
}
}
}
}
//
#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
inet_addr
(
cp
:
*
const
c_char
)
->
in_addr_t
{
pub
extern
"C"
fn
inet_addr
(
cp
:
*
const
c_char
)
->
in_addr_t
{
unimplemented!
();
let
mut
val
:
in_addr
=
in_addr
{
s_addr
:
0
,
};
if
unsafe
{
inet_aton
(
cp
,
&
mut
val
)
}
>
0
{
val
.s_addr
}
else
{
INADDR_NONE
}
}
}
//#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
inet_lnaof
(
_in
:
in_addr
)
->
in_addr_t
{
pub
extern
"C"
fn
inet_lnaof
(
input
:
in_addr
)
->
in_addr_t
{
unimplemented!
();
if
input
.s_addr
>>
24
<
128
{
input
.s_addr
&
0xffffff
}
else
if
input
.s_addr
>>
24
<
192
{
input
.s_addr
&
0xffff
}
else
{
input
.s_addr
&
0xff
}
}
}
//#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
inet_makeaddr
(
net
:
in_addr_t
,
lna
:
in_addr_t
)
->
in_addr
{
pub
extern
"C"
fn
inet_makeaddr
(
net
:
in_addr_t
,
host
:
in_addr_t
)
->
in_addr
{
unimplemented!
();
let
mut
output
:
in_addr
=
in_addr
{
s_addr
:
0
,
};
if
net
<
256
{
output
.s_addr
=
host
|
net
<<
24
;
}
else
if
net
<
65536
{
output
.s_addr
=
host
|
net
<<
16
;
}
else
{
output
.s_addr
=
host
|
net
<<
8
;
}
output
}
}
//#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
inet_netof
(
_in
:
in_addr
)
->
in_addr_t
{
pub
extern
"C"
fn
inet_netof
(
input
:
in_addr
)
->
in_addr_t
{
unimplemented!
();
if
input
.s_addr
>>
24
<
128
{
input
.s_addr
&
0xffffff
}
else
if
input
.s_addr
>>
24
<
192
{
input
.s_addr
&
0xffff
}
else
{
input
.s_addr
&
0xff
}
}
}
//#[no_mangle]
pub
extern
"C"
fn
inet_network
(
cp
:
*
const
c_char
)
->
in_addr_t
{
unimplemented!
();
#[no_mangle]
pub
extern
"C"
fn
inet_network
(
cp
:
*
mut
c_char
)
->
in_addr_t
{
ntohl
(
inet_addr
(
cp
))
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment