<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.ethernut.de/nutwiki/index.php?action=history&amp;feed=atom&amp;title=Network_Configuration_Using_a_Configuration_Editor</id>
		<title>Network Configuration Using a Configuration Editor - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.ethernut.de/nutwiki/index.php?action=history&amp;feed=atom&amp;title=Network_Configuration_Using_a_Configuration_Editor"/>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Network_Configuration_Using_a_Configuration_Editor&amp;action=history"/>
		<updated>2026-04-18T19:45:27Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://www.ethernut.de/nutwiki/index.php?title=Network_Configuration_Using_a_Configuration_Editor&amp;diff=176&amp;oldid=prev</id>
		<title>Harald: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Network_Configuration_Using_a_Configuration_Editor&amp;diff=176&amp;oldid=prev"/>
				<updated>2016-10-27T16:02:58Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:02, 27 October 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Harald</name></author>	</entry>

	<entry>
		<id>http://www.ethernut.de/nutwiki/index.php?title=Network_Configuration_Using_a_Configuration_Editor&amp;diff=175&amp;oldid=prev</id>
		<title>Harald: /* See also */</title>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Network_Configuration_Using_a_Configuration_Editor&amp;diff=175&amp;oldid=prev"/>
				<updated>2010-04-14T10:15:10Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;See also&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Test Environments ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;smalldiv&amp;quot;&lt;br /&gt;
| style=&amp;quot;background-color:#F6F9ED&amp;quot; |&lt;br /&gt;
| style=&amp;quot;background-color:#F6F9ED&amp;quot; | Hardware&amp;lt;br&amp;gt;Comments&lt;br /&gt;
| style=&amp;quot;background-color:#F6F9ED&amp;quot; | '''Nut/OS&amp;lt;br&amp;gt;4.6.4'''&lt;br /&gt;
| style=&amp;quot;background-color:#F6F9ED&amp;quot; | '''Nut/OS&amp;lt;br&amp;gt;4.7.4'''&lt;br /&gt;
| style=&amp;quot;background-color:#F6F9ED&amp;quot; | '''Nut/OS&amp;lt;br&amp;gt;4.8.0'''&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Ethernut 1.3 H&amp;lt;/span&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut13H-nutos-4.6.4.zip '''Binaries''']&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut13H-nutos-4.7.4.zip '''Binaries''']&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut13H-nutos-4.8.0.zip '''Binaries''']&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Ethernut 2.1 B&amp;lt;/span&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut21B-nutos-4.6.4.zip '''Binaries''']&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut21B-nutos-4.7.4.zip '''Binaries''']&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut21B-nutos-4.8.0.zip '''Binaries''']&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Ethernut 3.0 E&amp;lt;/span&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut30E-nutos-4.6.4.zip '''Binaries''']&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut30E-nutos-4.7.4.zip '''Binaries''']&lt;br /&gt;
| OK &amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-enut30E-nutos-4.8.0.zip '''Binaries''']&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;EIR 1.0 C&amp;lt;/span&amp;gt;&lt;br /&gt;
| Set jumper JP1 to UART mode. &lt;br /&gt;
| Configuration&amp;lt;br&amp;gt;Error.&lt;br /&gt;
| Configuration&amp;lt;br&amp;gt;Error.&lt;br /&gt;
| OK&amp;lt;br&amp;gt; [http://ethernut.de/arc/WIKI_BINARIES_ZIPPED/network-configuration-editor-eir1c-nutos-4.8.0.zip '''Binaries''']&amp;lt;br&amp;gt; Sometimes ignores key strokes&lt;br /&gt;
|-&lt;br /&gt;
| id=&amp;quot;compilertd&amp;quot; colspan=&amp;quot;5&amp;quot; |'''Compiler:''' ARM-GCC 4.2.2 ; AVR-GCC 4.3.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The following application is a simple editor, which allows to modify the network configuration stored in non-volatile memory.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;dev/board.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/confnet.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdint.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;io.h&amp;gt;&lt;br /&gt;
#include &amp;lt;arpa/inet.h&amp;gt;&lt;br /&gt;
#include &amp;lt;netinet/if_ether.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Reads line from standard input. */&lt;br /&gt;
static int EditLine(char *prompt, char *line, int siz)&lt;br /&gt;
{&lt;br /&gt;
    int ch;&lt;br /&gt;
    int pos = strlen(line);&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;%s: %s&amp;quot;, prompt, line);&lt;br /&gt;
    for (;;) {&lt;br /&gt;
        ch = getchar();&lt;br /&gt;
        if (ch == 8) {&lt;br /&gt;
            if (pos) {&lt;br /&gt;
                pos--;&lt;br /&gt;
                printf(&amp;quot;\b \b&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        else if (ch &amp;lt; ' ') {&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        else if (pos + 1 &amp;lt; siz) {&lt;br /&gt;
            putchar(ch);&lt;br /&gt;
            line[pos++] = ch;&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            putchar('\a');&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    line[pos] = 0;&lt;br /&gt;
    putchar('\n');&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Editor main routine. */&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
    u_long baud = 115200;&lt;br /&gt;
    char buf[32];&lt;br /&gt;
    uint8_t *cp;&lt;br /&gt;
    uint32_t addr;&lt;br /&gt;
    char ch;&lt;br /&gt;
&lt;br /&gt;
    /* Assign stdin and stdout to the default UART device. */&lt;br /&gt;
    NutRegisterDevice(&amp;amp;DEV_UART, 0, 0);&lt;br /&gt;
    freopen(DEV_UART_NAME, &amp;quot;w&amp;quot;, stdout);&lt;br /&gt;
    freopen(DEV_UART_NAME, &amp;quot;r&amp;quot;, stdin);    &lt;br /&gt;
    _ioctl(_fileno(stdout), UART_SETSPEED, &amp;amp;baud);&lt;br /&gt;
    puts(&amp;quot;Network Configuration Editor&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    for (;;) {&lt;br /&gt;
        /* Load configuration. */&lt;br /&gt;
        if (NutNetLoadConfig(DEV_ETHER_NAME)) {&lt;br /&gt;
            puts(&amp;quot;\nNo configuration available&amp;quot;);&lt;br /&gt;
            memcpy(confnet.cd_name, DEV_ETHER_NAME, sizeof(confnet.cd_name));&lt;br /&gt;
        } else {&lt;br /&gt;
            puts(&amp;quot;\nConfiguration loaded&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        /* Edit MAC address. */&lt;br /&gt;
        do {&lt;br /&gt;
            strcpy(buf, ether_ntoa(confnet.cdn_mac));&lt;br /&gt;
            EditLine(&amp;quot;MAC Address&amp;quot;, buf, 18);&lt;br /&gt;
            cp = ether_aton(buf);&lt;br /&gt;
        } while (cp == NULL);&lt;br /&gt;
        memcpy(confnet.cdn_mac, cp, 6);&lt;br /&gt;
&lt;br /&gt;
        /* Edit IP address. */&lt;br /&gt;
        do {&lt;br /&gt;
            strcpy(buf, inet_ntoa(confnet.cdn_cip_addr));&lt;br /&gt;
            EditLine(&amp;quot;IP Address&amp;quot;, buf, 16);&lt;br /&gt;
            addr = inet_addr(buf);&lt;br /&gt;
        } while (addr == -1);&lt;br /&gt;
        confnet.cdn_cip_addr = addr;&lt;br /&gt;
&lt;br /&gt;
        /* Edit IP mask. */&lt;br /&gt;
        do {&lt;br /&gt;
            strcpy(buf, inet_ntoa(confnet.cdn_ip_mask));&lt;br /&gt;
            EditLine(&amp;quot;IP Mask&amp;quot;, buf, 16);&lt;br /&gt;
            addr = inet_addr(buf);&lt;br /&gt;
        } while (addr == -1);&lt;br /&gt;
        confnet.cdn_ip_mask = addr;&lt;br /&gt;
&lt;br /&gt;
        /* Edit IP gate. */&lt;br /&gt;
        do {&lt;br /&gt;
            strcpy(buf, inet_ntoa(confnet.cdn_gateway));&lt;br /&gt;
            EditLine(&amp;quot;IP Gate&amp;quot;, buf, 16);&lt;br /&gt;
            addr = inet_addr(buf);&lt;br /&gt;
        } while (addr == -1);&lt;br /&gt;
        confnet.cdn_gateway = addr;&lt;br /&gt;
&lt;br /&gt;
        /* Prompt for saving. */&lt;br /&gt;
        printf(&amp;quot;\nPress S to save this configuration &amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        /* Flush input buffer and read next character. */&lt;br /&gt;
        while (kbhit()) {&lt;br /&gt;
            ch = getchar();&lt;br /&gt;
        }&lt;br /&gt;
        ch = getchar();&lt;br /&gt;
&lt;br /&gt;
        /* Save or discard edited configuration. */&lt;br /&gt;
        if (ch == 's' || ch == 'S') {&lt;br /&gt;
            if (NutNetSaveConfig()) {&lt;br /&gt;
                puts(&amp;quot;Failed&amp;quot;);&lt;br /&gt;
            } else {&lt;br /&gt;
                puts(&amp;quot;Saved&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        } else {&lt;br /&gt;
            puts(&amp;quot;Discarded&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Output ==&lt;br /&gt;
&lt;br /&gt;
 Network Configuration Editor&lt;br /&gt;
 &amp;amp;nbsp;&lt;br /&gt;
 Configuration loaded&lt;br /&gt;
 MAC Address: 00:06:98:30:02:76&lt;br /&gt;
 IP Address: 192.168.192.111&lt;br /&gt;
 IP Mask: 255.255.255.0&lt;br /&gt;
 IP Mask: 0.0.0.0&lt;br /&gt;
 &amp;amp;nbsp;&lt;br /&gt;
 Press S to save this configuration Saved&lt;br /&gt;
&lt;br /&gt;
Now you can try it out by executing [[Network Configuration Using Stored Configuration]].&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Network Configuration]] Overview&lt;br /&gt;
** [[Network Configuration Using Stored Configuration]]&lt;br /&gt;
** [[Network Configuration Using Hard Coded Configuration]]&lt;br /&gt;
** [[Discovery Service]]&lt;br /&gt;
* [[Basic TCP Server]]&lt;br /&gt;
* [[Basic TCP Client]]&lt;br /&gt;
* More [[Nut/OS Examples]]&lt;br /&gt;
&lt;br /&gt;
= External Links =&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Mac_address MAC address] A Media Access Control address (MAC address) is a unique identifier assigned to network adapters for identification.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Ip_address IP address] A numerical identification that is assigned to devices participating in a computer network utilizing the Internet Protocol.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Dhcp Dynamic Host Configuration Protocol] A protocol used by networked devices to obtain the parameters necessary for operation in an Internet Protocol network.&lt;br /&gt;
&lt;br /&gt;
[[Category:Code Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Languages}}&lt;/div&gt;</summary>
		<author><name>Harald</name></author>	</entry>

	</feed>