Writing Junos Xml Protocol C Client Applications; Establishing A Junos Xml Protocol Session - Juniper JUNOS OS 10.3 - XML MANAGEMENT PROTOCOL GUIDE 6-30-2010 Manual

Junos xml management protocol guide
Hide thumbs Also See for JUNOS OS 10.3 - XML MANAGEMENT PROTOCOL GUIDE 6-30-2010:
Table of Contents

Advertisement

CHAPTER 10
Writing Junos XML Protocol C Client
Applications

Establishing a Junos XML Protocol Session

Copyright © 2010, Juniper Networks, Inc.
In this section, we offer two examples of using C to create client applications to access
routers, switches, and security devices running Junos OS. The first example shows how
to establish a Junos XML protocol session. The second example, shows how to retrieve
and manipulate device configurations using C.
Establishing a Junos XML Protocol Session on page 233
Accessing and Editing Device Configurations on page 234
The following example illustrates how a client application written in C can use the SSH
or Telnet protocol to establish a Junos XML protocol connection and session. In the line
that begins with the string
(Substitute the
command if appropriate.) The
telnet
routine specifies the hostname or IP address of the Junos XML protocol server
execlp
device. The
argument is the command that converts the connection to a Junos
junoscript
XML protocol session.
For more information about Junos XML protocol sessions, see "Controlling the Junos XML
Management Protocol Session" on page 25.
int ipipes[ 2 ], opipes[ 2 ];
pid_t pid;
int rc;
char buf[ BUFSIZ ];
if (pipe(ipipes) <0 || pipe(opipes) <0)
err(1, "pipe failed");
pid = fork( );
if (pid <0)
err(1, "fork failed");
if (pid == 0) {
dup2(opipes[ 0 ], STDIN_FILENO);
dup2(ipipes[ 1 ], STDOUT_FILENO);
dup2(ipipes[ 1 ], STDERR_FILENO);
execlp
, the client application invokes the
ssh
command.
argument to the
routing-platform
233

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junos os

Table of Contents