Accessing And Editing Device Configurations - 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

Junos 10.3 Junos XML Management Protocol Guide

Accessing and Editing Device Configurations

234
close(ipipes[ 0 ]); /* close read end of pipe */
close(ipipes[ 1 ]); /* close write end of pipe */
close(opipes[ 0 ]); /* close read end of pipe */
close(opipes[ 1 ]); /* close write end of pipe */
execlp("ssh", "ssh", "-x", routing-platform , "junoscript", NULL);
err (1, "unable to execute: ssh %s junoscript," device);
}
close(ipipes[ 1 ]); /* close write end of pipe */
close(opipes[ 0 ]); /* close read end of pipe */
if (write(opipes[ 1 ], initial_handshake, strlen(initial_handshake)) <0 )
err(1, "writing initial handshake failed");
rc=read(ipipes[ 0 ], buf, sizeof(buf));
if (rc <0)
err(1, "read initial handshake failed");
This example code shows a script that can be used to access, manipulate and commit
device configurations using C.
//--Includes--//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <errno.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
//--Defines--//
//#define PRINT
//--Toggles printing of all data to and from js server--//
//--Global Variables and Initialization--//
int sockfd;
char *xmlns_start_ptr = NULL;
char *xmlns_end_ptr = NULL;
int sock_bytes, pim_output_len, igmp_output_len, count_a, count_x, count_y,
count_z, repl_str_len, orig_len, up_to_len, remain_len, conf_chg;
struct sockaddr_in serv_addr;
struct hostent *server;
char temp_buff[1024];
//--sending js configuration commands--//
char rcvbuffer[255];
char *pim_output_ptr = NULL; //--Pointer for pim_output from socket--//
//--buffer--//
char *igmp_output_ptr = NULL; //--Pointer for igmp_output from socket buffer--//
//--Temporary buffer used when --//
//--Stores data from socket--//
Copyright © 2010, Juniper Networks, Inc.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junos os

Table of Contents