Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lyskom-server-ceder-1616-generations-topgit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
33d0b237
Commit
33d0b237
authored
Jul 25, 1993
by
nobody
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This commit was manufactured by cvs2svn to create branch 'isc'.
parent
e7461ae5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
281 additions
and
0 deletions
+281
-0
src/libraries/libisc-new/.cvsignore
src/libraries/libisc-new/.cvsignore
+1
-0
src/libraries/libisc-new/demo/mux.c
src/libraries/libisc-new/demo/mux.c
+261
-0
src/libraries/libisc-new/demo/mux.h
src/libraries/libisc-new/demo/mux.h
+16
-0
src/libraries/libisc-new/doc/.cvsignore
src/libraries/libisc-new/doc/.cvsignore
+1
-0
src/libraries/libisc-new/man/.cvsignore
src/libraries/libisc-new/man/.cvsignore
+1
-0
src/libraries/libisc-new/src/.cvsignore
src/libraries/libisc-new/src/.cvsignore
+1
-0
No files found.
src/libraries/libisc-new/.cvsignore
0 → 100644
View file @
33d0b237
Topdir.make
src/libraries/libisc-new/demo/mux.c
0 → 100644
View file @
33d0b237
/*
** libmux.c A set of functions to implement a multiplexing
** protocol above the ISC library
**
** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
** 920210 pen initial coding
*/
#include <stdio.h>
#include <isc.h>
#include "mux.h"
#define MAXSESSIONS 20
typedef
struct
mux_session
{
IscSession
*
scb
;
int
id
;
}
MuxSession
;
typedef
struct
mux_control
{
IscSession
*
scb
[
MAXSESSIONS
];
}
MuxControl
;
static
int
mux_session_write_fn
(
IscHandlerList
*
hl
,
IscSession
*
scb
,
IscMessage
*
msg
)
{
/* Here, SCB is a pointer to a MUX simulated session */
MuxSession
*
msp
=
scb
->
udg
;
isc_printf
(
msp
->
scb
,
"MSG #%d %d:"
,
msp
->
id
,
msg
->
length
);
isc_write
(
msp
->
scb
,
msg
->
buffer
,
msg
->
length
);
isc_flush
(
msp
->
scb
);
return
msg
->
length
;
}
static
int
mux_session_close_fn
(
IscHandlerList
*
hl
,
IscSession
*
scb
)
{
return
0
;
}
static
void
mux_session_destroy_fn
(
IscHandlerList
*
hl
,
IscSession
*
scb
)
{
MuxSession
*
msp
;
MuxControl
*
mcp
;
msp
=
scb
->
udg
;
/* Remove this MUX session from the MUX controller */
mcp
=
msp
->
scb
->
udg
;
mcp
->
scb
[
msp
->
id
]
=
NULL
;
free
(
msp
);
}
static
IscSessionFuns
isc_session_funs
=
{
NULL
,
&
mux_session_write_fn
,
&
mux_session_close_fn
,
NULL
,
NULL
,
&
mux_session_destroy_fn
,
NULL
};
/*
** Allocate storage for a MUX control structure
*/
MuxControl
*
mux_newcontrol
(
void
)
{
MuxControl
*
mcp
;
int
i
;
mcp
=
malloc
(
sizeof
(
MuxControl
));
if
(
!
mcp
)
return
NULL
;
for
(
i
=
0
;
i
<
MAXSESSIONS
;
i
++
)
mcp
->
scb
[
i
]
=
NULL
;
return
mcp
;
}
/*
** Create a new MUX session on a MUX control session
*/
IscSession
*
mux_newsession
(
IscSession
*
scb
)
{
MuxSession
*
msp
;
MuxControl
*
mcp
;
int
i
;
mcp
=
scb
->
udg
;
for
(
i
=
0
;
i
<
MAXSESSIONS
;
i
++
)
if
(
mcp
->
scb
[
i
]
==
NULL
)
{
msp
=
malloc
(
sizeof
(
MuxSession
));
if
(
!
msp
)
return
NULL
;
mcp
->
scb
[
i
]
=
isc_create
(
scb
->
cfg
,
&
mux_session_funs
);
msp
->
id
=
i
;
msp
->
scb
=
scb
;
mcp
->
scb
[
i
]
->
udg
=
msp
;
return
scb
;
}
return
NULL
;
}
int
mux_control_close_fn
(
IscHandlerList
*
hl
,
IscSession
*
scb
)
{
MuxControl
*
mcp
;
int
i
;
mcp
=
scb
->
udg
;
for
(
i
=
0
;
i
<
MAXSESSIONS
;
i
++
)
if
(
mcp
->
scb
[
i
])
{
isc_close
(
mcp
->
scb
[
i
]);
mcp
->
scb
[
i
]
=
NULL
;
}
if
(
!
hl
)
return
0
;
else
return
(
*
hl
->
hcb
->
close
)(
hl
->
old
.
close
,
scb
);
}
void
mux_control_destroy_fn
(
IscSession
*
scb
)
{
mux_control_close_fn
(
scb
);
free
(
mcp
);
}
IscEvent
*
mux_control_parse_fn
(
IscSession
*
scb
,
IscMesssage
*
msg
)
{
MuxControl
*
mcp
;
IscEvent
*
ep
;
IscMessage
*
nmsg
;
int
id
;
/* Here we handle the MUX-to-MUX protocol */
mcp
=
scb
->
udg
;
ep
=
isc_newevent
();
while
(
parse_msg
(
msg
,
&
ep
->
event
,
&
id
,
&
nmsg
))
switch
(
ep
->
event
)
{
case
ISC_EVENT_LOGIN
:
ep
->
session
=
mux_newsession
(
scb
);
return
ep
;
case
ISC_EVENT_LOGOUT
:
isc_close
(
mcp
->
scb
[
id
]);
mcp
->
scb
[
id
]
=
NULL
;
break
;
case
ISC_EVENT_MESSAGE
:
isc_pushqueue
(
mcp
->
scb
[
id
]
->
rd_msg_q
,
nmsg
);
break
;
default:
/* Do something, perhaps */
}
return
NULL
;
}
/*
** Callback function to accept new sessions
*/
IscSession
*
mux_control_accept_fn
(
IscSession
*
scb
,
IscMessage
*
msg
)
{
IscSession
*
nscb
;
nscb
=
isc_tcp_accept_fn
(
scb
,
msg
);
nscb
->
fun
->
close
=
&
mux_control_close_fn
;
nscb
->
fun
->
destroy
=
&
mux_control_destroy_fn
;
nscb
->
fun
->
parse
=
&
mux_control_parse_fn
;
nscb
->
udg
=
mux_newcontrol
();
return
nscb
;
}
/*
** Establish a TCP/IP port to listen at for new MUX connections
*/
IscSession
*
mux_listentcp
(
IscMaster
*
mcb
,
const
char
*
address
,
const
char
*
service
)
{
IscSession
*
scb
;
scb
=
isc_listentcp
(
mcb
,
address
,
service
);
if
(
!
scb
)
return
NULL
scb
->
fun
->
accept
=
&
mux_control_accept_fn
;
return
scb
;
}
src/libraries/libisc-new/demo/mux.h
0 → 100644
View file @
33d0b237
/*
** mux.h A set of functions to implement a multiplexing
** protocol above the ISC library
**
** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
** 920210 pen initial coding
*/
#ifndef __MUX_H__
#define __MUX_H__
#endif
src/libraries/libisc-new/doc/.cvsignore
0 → 100644
View file @
33d0b237
Topdir.make
src/libraries/libisc-new/man/.cvsignore
0 → 100644
View file @
33d0b237
Topdir.make
src/libraries/libisc-new/src/.cvsignore
0 → 100644
View file @
33d0b237
Topdir.make
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