libosmovty 1.9.0.196-9975
Osmocom VTY library
telnet_interface.c File Reference

Telnet interface towards Osmocom VTY. More...

#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/signal.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/buffer.h>
#include <osmocom/vty/command.h>

Functions

 LLIST_HEAD (active_connections)
 
static int telnet_new_connection (struct osmo_fd *fd, unsigned int what)
 
static int _telnet_init_dynif (void *tall_ctx, void *priv, const char *ip, int port)
 
int telnet_init (void *tall_ctx, void *priv, int port)
 Initialize telnet based VTY interface listening to 127.0.0.1. More...
 
int telnet_init_dynif (void *tall_ctx, void *priv, const char *ip, int port)
 Initialize telnet based VTY interface. More...
 
int telnet_init_default (void *tall_ctx, void *priv, int default_port)
 Initializes telnet based VTY interface using the configured bind addr/port. More...
 
int telnet_close_client (struct osmo_fd *fd)
 close a telnet connection More...
 
static int client_data (struct osmo_fd *fd, unsigned int what)
 
bool vty_is_active (struct vty *vty)
 
void vty_event (enum event event, int sock, struct vty *vty)
 callback from core VTY code about VTY related events More...
 
void telnet_exit (void)
 Close all telnet connections and release the telnet socket. More...
 

Variables

static void * tall_telnet_ctx
 
static struct osmo_fd server_socket
 
struct host host
 

Detailed Description

Telnet interface towards Osmocom VTY.

This module contains the code implementing a telnet server for VTY access. This telnet server gets linked into each libosmovty-using process in order to enable interactive command-line introspection, interaction and configuration.

You typically call telnet_init_default once from your application code to enable this.

Function Documentation

◆ _telnet_init_dynif()

static int _telnet_init_dynif ( void *  tall_ctx,
void *  priv,
const char *  ip,
int  port 
)
static

◆ client_data()

static int client_data ( struct osmo_fd fd,
unsigned int  what 
)
static

◆ LLIST_HEAD()

LLIST_HEAD ( active_connections  )

◆ telnet_close_client()

◆ telnet_new_connection()

◆ vty_event()

Variable Documentation

◆ server_socket

struct osmo_fd server_socket
static
Initial value:
= {
.when = OSMO_FD_READ,
.priv_nr = 0,
}
#define OSMO_FD_READ
static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:177

Referenced by _telnet_init_dynif(), and telnet_exit().

◆ tall_telnet_ctx

void* tall_telnet_ctx
static