Sponsored Content
Top Forums Programming Reading a router configuration file Post 302749065 by DGPickett on Thursday 27th of December 2012 12:22:51 PM
Old 12-27-2012
You might just mmap() the file or fread the whole into one malloc'd buffer in one fell swoop, and then much less malloc(). If there 2,4,8 byte integers or any sort of floats in the data, write a subroutine for converting the big or little endian to the native flavor, exploiting the match if you are so lucky (LE on a LE machine).

It might be nice to present it as a simple file of name=value lines, and have a reverse conversion. Of course, the router may be fussy about the order.

Cryptic, well, that could be unicode, utf8, or ebcdic rather than the simple ascii a C programmer usually expects. Do some dump reading and see what it thinks a character string is. I guess they are null terminated or something, as there is no length provided, unless it is hidded just before the string (a common practice -- positive offsets are payload, negatve offsets are the control structure, so the 'char' pointer is to the tail character string of a variable length struct).
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a value from the configuration file

Hi, I have prepared a config file in which I am declaring the value for a country such as: COUNTRY=USA Now I am trying to read the country from the config file and print a message based on the same. I have written the following code in a script and when executing the script I getting an error. ... (14 Replies)
Discussion started by: yoursdavinder
14 Replies

2. UNIX for Dummies Questions & Answers

Remote Unix printing to my WinXP works with no router. How can I make it work through my router?

I set up remote printing on a clients Unix server to my Windows XP USB printer. My USB printer is connected directly to my PC (no print server and no network input on printer). With my Win XP PC connected to my cable modem (without the router), i can do lp -dhp842c /etc/hosts and it prints. I... (7 Replies)
Discussion started by: jmhohne
7 Replies

3. Shell Programming and Scripting

reading configuration files in bash. Best way?

Context: I have a random pin number generator script that reads a tab-delimited file containing a location and a count: eg., mansfield 30 tokyo 15 smithville 34It produces random PIN# in the amount specified by the number in the second column. Currently, I read the file... (7 Replies)
Discussion started by: Bubnoff
7 Replies

4. IP Networking

How to show Cisco Router Running Configuration in Third Party Application

Hey everyone, I have a few question. 1. Is it possible to display cisco 'show run' output command to the application ?? 2. And is there any ways to log in to the router instead of using telnet from telnet application??? Thanks in advance (0 Replies)
Discussion started by: franzramadhan
0 Replies

5. Shell Programming and Scripting

Expect script to save configuration from a router

Hy guys, My name is Alex, i am new here and I hope to find some answers. I am trying to run a expect script to telnet to a mikrotik router, run a command (export), and save the output of that commant to a file (outputfile.txt). The problem is that only part of the output is saved to... (2 Replies)
Discussion started by: axexandru
2 Replies
MRINFO(8)						      System Manager's Manual							 MRINFO(8)

NAME
mrinfo - Displays configuration info from a multicast router SYNOPSIS
/usr/sbin/mrinfo [ -d debug_level ] [ -r retry_count ] [ -t timeout_count ] multicast_router DESCRIPTION
mrinfo attempts to display the configuration information from the multicast router multicast_router. mrinfo uses the ASK_NEIGHBORS IGMP message to the specified multicast router. If this multicast router responds, the version number and a list of their neighboring multicast router addresses is part of that response. If the responding router has a recent multicast version num- ber, then mrinfo requests additional information such as metrics, thresholds, and flags from the multicast router. Once the specified mul- ticast router responds, the configuration is displayed to the standard output. INVOCATION
"-d" option sets the debug level. When the debug level is greater than the default value of 0, addition debugging messages are printed. Regardless of the debug level, an error condition, will always write an error message and will cause mrinfo to terminate. Non-zero debug levels have the following effects: level 1 packet warnings are printed to stderr. level 2 all level 1 messages plus notifications down networks are printed to stderr. level 3 all level 2 messages plus notifications of all packet timeouts are printed to stderr. "-r retry_count" sets the neighbor query retry limit. Default is 3 retry. "-t timeout_count" sets the number of seconds to wait for a neighbor query reply. Default timeout is 4 seconds. SAMPLE OUTPUT
mrinfo mbone.phony.dom.net 127.148.176.10 (mbone.phony.dom.net) [version 3.3]: 127.148.176.10 - 0.0.0.0 (?) [1/1/querier] 127.148.176.10 - 127.0.8.4 (mbone2.phony.dom.net) [1/45/tunnel] 127.148.176.10 - 105.1.41.9 (momoney.com) [1/32/tunnel/down] 127.148.176.10 - 143.192.152.119 (mbone.dipu.edu) [1/32/tunnel] For each neighbor of the queried multicast router, the IP of the queried router is displayed, followed by the IP and name of the neighbor. In square brackets the metric (cost of connection), the threshold (multicast ttl) is displayed. If the queried multicast router has a newer version number, the type (tunnel, srcrt) and status (disabled, down) of the connection is displayed. IMPORTANT NOTE
mrinfo must be run as root. SEE ALSO
mrouted(8), map-mbone(8), mtrace(8) AUTHOR
Van Jacobson 4.2 Berkeley Distribution MRINFO(8)
All times are GMT -4. The time now is 08:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy