Skip to content

Commit 2f08363

Browse files
committed
Channel Type Accessor
Each channel has a type: session, forward, etc. Add an accessor to return the channel type for the specified channel.
1 parent 023b7d7 commit 2f08363

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/ssh.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,18 @@ void wolfSSH_SetKeyingCompletionCbCtx(WOLFSSH* ssh, void* ctx)
32823282
}
32833283

32843284

3285+
const char* wolfSSH_ChannelGetType(const WOLFSSH_CHANNEL* channel)
3286+
{
3287+
const char* name = NULL;
3288+
3289+
if (channel != NULL) {
3290+
name = IdToName(channel->channelType);
3291+
}
3292+
3293+
return name;
3294+
}
3295+
3296+
32853297
WS_SessionType wolfSSH_ChannelGetSessionType(const WOLFSSH_CHANNEL* channel)
32863298
{
32873299
WS_SessionType type = WOLFSSH_SESSION_UNKNOWN;

wolfssh/ssh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ WOLFSSH_API int wolfSSH_ChannelRead(WOLFSSH_CHANNEL*, byte*, word32);
229229
WOLFSSH_API int wolfSSH_ChannelSend(WOLFSSH_CHANNEL*, const byte*, word32);
230230
WOLFSSH_API int wolfSSH_ChannelExit(WOLFSSH_CHANNEL*);
231231
WOLFSSH_API int wolfSSH_ChannelGetEof(WOLFSSH_CHANNEL*);
232+
WOLFSSH_API const char* wolfSSH_ChannelGetType(
233+
const WOLFSSH_CHANNEL* channel);
232234
WOLFSSH_API WS_SessionType wolfSSH_ChannelGetSessionType(
233235
const WOLFSSH_CHANNEL* channel);
234236
WOLFSSH_API const char* wolfSSH_ChannelGetSessionCommand(

0 commit comments

Comments
 (0)