samples: net: Add IRC bot example
This is a sample IRC bot program, written using the new IP stack API.
All it does is join an IRC channel, wait for some commands, and react
to them:
!hello will greet whoever sent the command
!random will generate a pseudo-random number and send it back
!led_toggle will toggle an LED in the board [1]
!led_on will turn the LED on regardless of its current state
!led_off will turn the LED off
!rejoin will part the current channel and join again
!disconnect will quit from the IRC server
As far as the IRC protocol goes, it doesn't do much more than this, but
it should be straightforward to add support for other things (such as
notices, CTCP, DCC, etc) if someone is inclined to do so. However,
that's way beyond the scope of this sample, which is to show how to use
the network API to write a TCP client.
Some things are still missing as an example of how to use the APIs,
namely DNS resolution, automatically setting up the network with DHCP,
maybe saving settings on EEPROM. These are good candidates to be added
in the future.
[1] The LED code has been shamelessly stolen from the CoAP sample code.
Change-Id: I7152e97c0726f3559db545579ae8ae8d07bf04cd
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-19 08:57:57 +08:00
|
|
|
CONFIG_INIT_STACKS=y
|
|
|
|
|
|
|
|
CONFIG_NET_LOG_ENABLED=y
|
|
|
|
CONFIG_SYS_LOG_NET_LEVEL=2
|
2017-01-25 15:20:59 +08:00
|
|
|
CONFIG_NET_IPV4=y
|
|
|
|
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=3
|
samples: net: Add IRC bot example
This is a sample IRC bot program, written using the new IP stack API.
All it does is join an IRC channel, wait for some commands, and react
to them:
!hello will greet whoever sent the command
!random will generate a pseudo-random number and send it back
!led_toggle will toggle an LED in the board [1]
!led_on will turn the LED on regardless of its current state
!led_off will turn the LED off
!rejoin will part the current channel and join again
!disconnect will quit from the IRC server
As far as the IRC protocol goes, it doesn't do much more than this, but
it should be straightforward to add support for other things (such as
notices, CTCP, DCC, etc) if someone is inclined to do so. However,
that's way beyond the scope of this sample, which is to show how to use
the network API to write a TCP client.
Some things are still missing as an example of how to use the APIs,
namely DNS resolution, automatically setting up the network with DHCP,
maybe saving settings on EEPROM. These are good candidates to be added
in the future.
[1] The LED code has been shamelessly stolen from the CoAP sample code.
Change-Id: I7152e97c0726f3559db545579ae8ae8d07bf04cd
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-19 08:57:57 +08:00
|
|
|
CONFIG_NET_IPV6=y
|
2017-01-25 15:20:59 +08:00
|
|
|
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
|
samples: net: Add IRC bot example
This is a sample IRC bot program, written using the new IP stack API.
All it does is join an IRC channel, wait for some commands, and react
to them:
!hello will greet whoever sent the command
!random will generate a pseudo-random number and send it back
!led_toggle will toggle an LED in the board [1]
!led_on will turn the LED on regardless of its current state
!led_off will turn the LED off
!rejoin will part the current channel and join again
!disconnect will quit from the IRC server
As far as the IRC protocol goes, it doesn't do much more than this, but
it should be straightforward to add support for other things (such as
notices, CTCP, DCC, etc) if someone is inclined to do so. However,
that's way beyond the scope of this sample, which is to show how to use
the network API to write a TCP client.
Some things are still missing as an example of how to use the APIs,
namely DNS resolution, automatically setting up the network with DHCP,
maybe saving settings on EEPROM. These are good candidates to be added
in the future.
[1] The LED code has been shamelessly stolen from the CoAP sample code.
Change-Id: I7152e97c0726f3559db545579ae8ae8d07bf04cd
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-19 08:57:57 +08:00
|
|
|
CONFIG_NET_LOG=y
|
|
|
|
CONFIG_NET_MAX_CONTEXTS=10
|
|
|
|
CONFIG_NET_NBUF_DATA_COUNT=30
|
|
|
|
CONFIG_NET_NBUF_RX_COUNT=14
|
|
|
|
CONFIG_NET_NBUF_TX_COUNT=14
|
|
|
|
CONFIG_NET_SHELL=y
|
|
|
|
CONFIG_NET_SLIP_TAP=y
|
|
|
|
CONFIG_NET_STATISTICS=y
|
|
|
|
CONFIG_NET_TCP=y
|
|
|
|
CONFIG_NETWORKING=y
|
|
|
|
|
|
|
|
CONFIG_PRINTK=y
|
|
|
|
CONFIG_SYS_LOG_SHOW_COLOR=y
|
|
|
|
|
|
|
|
CONFIG_NET_SAMPLES_IP_ADDRESSES=y
|
|
|
|
CONFIG_NET_SAMPLES_MY_IPV6_ADDR="2001:db8::1"
|
|
|
|
CONFIG_NET_SAMPLES_PEER_IPV6_ADDR="2001:db8::2"
|
2017-01-25 15:20:59 +08:00
|
|
|
CONFIG_NET_SAMPLES_MY_IPV4_ADDR="192.168.0.1"
|
|
|
|
CONFIG_NET_SAMPLES_PEER_IPV4_ADDR="192.168.0.2"
|
samples: net: Add IRC bot example
This is a sample IRC bot program, written using the new IP stack API.
All it does is join an IRC channel, wait for some commands, and react
to them:
!hello will greet whoever sent the command
!random will generate a pseudo-random number and send it back
!led_toggle will toggle an LED in the board [1]
!led_on will turn the LED on regardless of its current state
!led_off will turn the LED off
!rejoin will part the current channel and join again
!disconnect will quit from the IRC server
As far as the IRC protocol goes, it doesn't do much more than this, but
it should be straightforward to add support for other things (such as
notices, CTCP, DCC, etc) if someone is inclined to do so. However,
that's way beyond the scope of this sample, which is to show how to use
the network API to write a TCP client.
Some things are still missing as an example of how to use the APIs,
namely DNS resolution, automatically setting up the network with DHCP,
maybe saving settings on EEPROM. These are good candidates to be added
in the future.
[1] The LED code has been shamelessly stolen from the CoAP sample code.
Change-Id: I7152e97c0726f3559db545579ae8ae8d07bf04cd
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-19 08:57:57 +08:00
|
|
|
|
|
|
|
CONFIG_TEST_RANDOM_GENERATOR=y
|