Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Main
Synchronet
Commits
de85abd6
Commit
de85abd6
authored
19 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Moved getSocketOptionList() and getSocketOptionByName() here from
sbbs3/sockopts.c.
parent
6a60f9d9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/sockwrap.c
+84
-0
84 additions, 0 deletions
src/xpdev/sockwrap.c
src/xpdev/sockwrap.h
+11
-1
11 additions, 1 deletion
src/xpdev/sockwrap.h
with
95 additions
and
1 deletion
src/xpdev/sockwrap.c
+
84
−
0
View file @
de85abd6
...
...
@@ -46,6 +46,90 @@
#include
"sockwrap.h"
/* sendsocket */
#include
"filewrap.h"
/* filelength */
static
socket_option_t
socket_options
[]
=
{
{
"TYPE"
,
SOL_SOCKET
,
SO_TYPE
},
{
"DEBUG"
,
SOL_SOCKET
,
SO_DEBUG
},
{
"LINGER"
,
SOL_SOCKET
,
SO_LINGER
},
{
"SNDBUF"
,
SOL_SOCKET
,
SO_SNDBUF
},
{
"RCVBUF"
,
SOL_SOCKET
,
SO_RCVBUF
},
{
"SNDLOWAT"
,
SOL_SOCKET
,
SO_SNDLOWAT
},
{
"RCVLOWAT"
,
SOL_SOCKET
,
SO_RCVLOWAT
},
{
"SNDTIMEO"
,
SOL_SOCKET
,
SO_SNDTIMEO
},
{
"RCVTIMEO"
,
SOL_SOCKET
,
SO_RCVTIMEO
},
{
"REUSEADDR"
,
SOL_SOCKET
,
SO_REUSEADDR
},
{
"KEEPALIVE"
,
SOL_SOCKET
,
SO_KEEPALIVE
},
{
"DONTROUTE"
,
SOL_SOCKET
,
SO_DONTROUTE
},
{
"BROADCAST"
,
SOL_SOCKET
,
SO_BROADCAST
},
{
"OOBINLINE"
,
SOL_SOCKET
,
SO_OOBINLINE
},
#ifdef SO_ACCEPTCONN
{
"ACCEPTCONN"
,
SOL_SOCKET
,
SO_ACCEPTCONN
},
#endif
/* IPPROTO-level socket options */
{
"TCP_NODELAY"
,
IPPROTO_TCP
,
TCP_NODELAY
},
/* The following are platform-specific */
#ifdef TCP_MAXSEG
{
"TCP_MAXSEG"
,
IPPROTO_TCP
,
TCP_MAXSEG
},
#endif
#ifdef TCP_CORK
{
"TCP_CORK"
,
IPPROTO_TCP
,
TCP_CORK
},
#endif
#ifdef TCP_KEEPIDLE
{
"TCP_KEEPIDLE"
,
IPPROTO_TCP
,
TCP_KEEPIDLE
},
#endif
#ifdef TCP_KEEPINTVL
{
"TCP_KEEPINTVL"
,
IPPROTO_TCP
,
TCP_KEEPINTVL
},
#endif
#ifdef TCP_KEEPCNT
{
"TCP_KEEPCNT"
,
IPPROTO_TCP
,
TCP_KEEPCNT
},
#endif
#ifdef TCP_SYNCNT
{
"TCP_SYNCNT"
,
IPPROTO_TCP
,
TCP_SYNCNT
},
#endif
#ifdef TCP_LINGER2
{
"TCP_LINGER2"
,
IPPROTO_TCP
,
TCP_LINGER2
},
#endif
#ifdef TCP_DEFER_ACCEPT
{
"TCP_DEFER_ACCEPT"
,
IPPROTO_TCP
,
TCP_DEFER_ACCEPT
},
#endif
#ifdef TCP_WINDOW_CLAMP
{
"TCP_WINDOW_CLAMP"
,
IPPROTO_TCP
,
TCP_WINDOW_CLAMP
},
#endif
#ifdef TCP_QUICKACK
{
"TCP_QUICKACK"
,
IPPROTO_TCP
,
TCP_QUICKACK
},
#endif
#ifdef TCP_NOPUSH
{
"TCP_NOPUSH"
,
IPPROTO_TCP
,
TCP_NOPUSH
},
#endif
#ifdef TCP_NOOPT
{
"TCP_NOOPT"
,
IPPROTO_TCP
,
TCP_NOOPT
},
#endif
{
NULL
}
};
int
getSocketOptionByName
(
const
char
*
name
,
int
*
level
)
{
int
i
;
if
(
level
!=
NULL
)
*
level
=
SOL_SOCKET
;
/* default option level */
for
(
i
=
0
;
socket_options
[
i
].
name
;
i
++
)
{
if
(
stricmp
(
name
,
socket_options
[
i
].
name
)
==
0
)
{
if
(
level
!=
NULL
)
*
level
=
socket_options
[
i
].
level
;
return
(
socket_options
[
i
].
value
);
}
}
if
(
!
isdigit
(
*
name
))
/* unknown option name */
return
(
-
1
);
return
(
strtol
(
name
,
NULL
,
0
));
}
socket_option_t
*
getSocketOptionList
(
void
)
{
return
(
socket_options
);
}
int
sendfilesocket
(
int
sock
,
int
file
,
long
*
offset
,
long
count
)
{
char
buf
[
1024
*
16
];
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/sockwrap.h
+
11
−
1
View file @
de85abd6
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
4
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
5
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -77,6 +77,12 @@
#include
<errno.h>
/* errno */
typedef
struct
{
char
*
name
;
int
level
;
int
value
;
}
socket_option_t
;
/**********************************/
/* Socket Implementation-specific */
/**********************************/
...
...
@@ -152,6 +158,10 @@ static wsa_error;
extern
"C"
{
#endif
socket_option_t
*
getSocketOptionList
(
void
);
int
getSocketOptionByName
(
const
char
*
name
,
int
*
level
);
int
sendfilesocket
(
int
sock
,
int
file
,
long
*
offset
,
long
count
);
int
recvfilesocket
(
int
sock
,
int
file
,
long
*
offset
,
long
count
);
BOOL
socket_check
(
SOCKET
sock
,
BOOL
*
rd_p
,
BOOL
*
wr_p
,
DWORD
timeout
);
...
...
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