Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
d7d7fa3a
Commit
d7d7fa3a
authored
Jul 29, 2000
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
NO_PIKE_SHORTHAND
Rev: src/modules/files/udp.c:1.12
parent
6afca9c5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/files/udp.c
+22
-21
22 additions, 21 deletions
src/modules/files/udp.c
with
22 additions
and
21 deletions
src/modules/files/udp.c
+
22
−
21
View file @
d7d7fa3a
/*
* $Id: udp.c,v 1.1
1
2000/07/
07 13:58:29 gr
ubb
a
Exp $
* $Id: udp.c,v 1.1
2
2000/07/
29 21:31:08 h
ubb
e
Exp $
*/
#define NO_PIKE_SHORTHAND
#include
"global.h"
#include
"file_machine.h"
RCSID
(
"$Id: udp.c,v 1.1
1
2000/07/
07 13:58:29 gr
ubb
a
Exp $"
);
RCSID
(
"$Id: udp.c,v 1.1
2
2000/07/
29 21:31:08 h
ubb
e
Exp $"
);
#include
"fdlib.h"
#include
"interpret.h"
#include
"svalue.h"
...
...
@@ -149,7 +150,7 @@ static void udp_bind(INT32 args)
if
(
args
<
1
)
error
(
"Too few arguments to dumudp->bind()
\n
"
);
if
(
sp
[
-
args
].
type
!=
T_INT
)
if
(
Pike_
sp
[
-
args
].
type
!=
PIKE_
T_INT
)
error
(
"Bad argument 1 to dumudp->bind()
\n
"
);
if
(
FD
!=
-
1
)
...
...
@@ -180,13 +181,13 @@ static void udp_bind(INT32 args)
MEMSET
((
char
*
)
&
addr
,
0
,
sizeof
(
struct
sockaddr_in
));
if
(
args
>
1
&&
sp
[
1
-
args
].
type
==
T_STRING
)
{
get_inet_addr
(
&
addr
,
sp
[
1
-
args
].
u
.
string
->
str
);
if
(
args
>
1
&&
Pike_
sp
[
1
-
args
].
type
==
PIKE_
T_STRING
)
{
get_inet_addr
(
&
addr
,
Pike_
sp
[
1
-
args
].
u
.
string
->
str
);
}
else
{
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
}
addr
.
sin_port
=
htons
(
((
u_short
)
sp
[
-
args
].
u
.
integer
)
);
addr
.
sin_port
=
htons
(
((
u_short
)
Pike_
sp
[
-
args
].
u
.
integer
)
);
addr
.
sin_family
=
AF_INET
;
THREADS_ALLOW_UID
();
...
...
@@ -199,7 +200,7 @@ static void udp_bind(INT32 args)
{
fd_close
(
fd
);
THIS
->
my_errno
=
errno
;
error
(
"UDP.bind: failed to bind to port %d
\n
"
,
sp
[
-
args
].
u
.
integer
);
error
(
"UDP.bind: failed to bind to port %d
\n
"
,
Pike_
sp
[
-
args
].
u
.
integer
);
return
;
}
...
...
@@ -313,17 +314,17 @@ void udp_read(INT32 args)
if
(
args
)
{
if
(
sp
[
-
args
].
u
.
integer
&
1
)
{
if
(
Pike_
sp
[
-
args
].
u
.
integer
&
1
)
{
flags
|=
MSG_OOB
;
}
if
(
sp
[
-
args
].
u
.
integer
&
2
)
{
if
(
Pike_
sp
[
-
args
].
u
.
integer
&
2
)
{
#ifdef MSG_PEEK
flags
|=
MSG_PEEK
;
#else
/* !MSG_PEEK */
/* FIXME: What should we do here? */
#endif
/* MSG_PEEK */
}
if
(
sp
[
-
args
].
u
.
integer
&
~
3
)
{
if
(
Pike_
sp
[
-
args
].
u
.
integer
&
~
3
)
{
error
(
"Illegal 'flags' value passed to udp->read([int flags])
\n
"
);
}
}
...
...
@@ -399,17 +400,17 @@ void udp_sendto(INT32 args)
if
(
args
>
3
)
{
if
(
sp
[
3
-
args
].
u
.
integer
&
1
)
{
if
(
Pike_
sp
[
3
-
args
].
u
.
integer
&
1
)
{
flags
|=
MSG_OOB
;
}
if
(
sp
[
3
-
args
].
u
.
integer
&
2
)
{
if
(
Pike_
sp
[
3
-
args
].
u
.
integer
&
2
)
{
#ifdef MSG_DONTROUTE
flags
|=
MSG_DONTROUTE
;
#else
/* !MSG_DONTROUTE */
/* FIXME: What should we do here? */
#endif
/* MSG_DONTROUTE */
}
if
(
sp
[
3
-
args
].
u
.
integer
&
~
3
)
{
if
(
Pike_
sp
[
3
-
args
].
u
.
integer
&
~
3
)
{
error
(
"Illegal 'flags' value passed to udp->send(string m,string t,int p,[int flags])
\n
"
);
}
}
...
...
@@ -418,16 +419,16 @@ void udp_sendto(INT32 args)
", string message, int port[, int flags])
\n
"
);
if
(
sp
[
-
args
].
type
==
T_STRING
)
get_inet_addr
(
&
to
,
sp
[
-
args
].
u
.
string
->
str
);
if
(
Pike_
sp
[
-
args
].
type
==
PIKE_
T_STRING
)
get_inet_addr
(
&
to
,
Pike_
sp
[
-
args
].
u
.
string
->
str
);
else
error
(
"Illegal type of argument to sendto, got non-string to-address.
\n
"
);
to
.
sin_port
=
htons
(
((
u_short
)
sp
[
1
-
args
].
u
.
integer
)
);
to
.
sin_port
=
htons
(
((
u_short
)
Pike_
sp
[
1
-
args
].
u
.
integer
)
);
fd
=
FD
;
str
=
sp
[
2
-
args
].
u
.
string
->
str
;
len
=
sp
[
2
-
args
].
u
.
string
->
len
;
str
=
Pike_
sp
[
2
-
args
].
u
.
string
->
str
;
len
=
Pike_
sp
[
2
-
args
].
u
.
string
->
len
;
do
{
THREADS_ALLOW
();
...
...
@@ -473,7 +474,7 @@ void udp_sendto(INT32 args)
void
zero_udp
(
struct
object
*
ignored
)
{
MEMSET
(
THIS
,
0
,
sizeof
(
struct
udp_storage
));
THIS
->
read_callback
.
type
=
T_INT
;
THIS
->
read_callback
.
type
=
PIKE_
T_INT
;
FD
=
-
1
;
}
...
...
@@ -513,9 +514,9 @@ static void udp_set_read_callback(INT32 args)
error
(
"Wrong number of arguments to file->set_read_callback().
\n
"
);
if
(
IS_ZERO
(
&
THIS
->
read_callback
))
assign_svalue
(
&
THIS
->
read_callback
,
sp
-
1
);
assign_svalue
(
&
THIS
->
read_callback
,
Pike_
sp
-
1
);
else
assign_svalue_no_free
(
&
THIS
->
read_callback
,
sp
-
1
);
assign_svalue_no_free
(
&
THIS
->
read_callback
,
Pike_
sp
-
1
);
if
(
IS_ZERO
(
&
THIS
->
read_callback
))
set_read_callback
(
FD
,
0
,
0
);
...
...
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