41#include "contiki-net.h"
47#define LOG_MODULE "SNMP"
48#define LOG_LEVEL LOG_LEVEL_SNMP
51#define SNMP_SERVER_PORT UIP_HTONS(SNMP_PORT)
52PROCESS(snmp_process,
"SNMP Process");
72 snmp_udp_conn =
udp_new(NULL, 0, NULL);
73 if(snmp_udp_conn == NULL) {
74 LOG_ERR(
"No UDP connection available, exiting the process!\n");
78 udp_bind(snmp_udp_conn, SNMP_SERVER_PORT);
79 LOG_DBG(
"Listening on port %u\n", uip_ntohs(snmp_udp_conn->
lport));
92 LOG_DBG(
"receiving UDP datagram from [");
94 LOG_DBG_(
"]:%u", uip_ntohs(UIP_UDP_BUF->srcport));
106 LOG_DBG(
"Error while handling the request\n");
110 LOG_DBG(
"Sending response\n");
112 uip_udp_packet_sendto(snmp_udp_conn, snmp_packet.
out, snmp_packet.
used, &
UIP_IP_BUF->srcipaddr, UIP_UDP_BUF->srcport);
void snmp_init()
Initializes the SNMP engine.
int snmp_engine(snmp_packet_t *snmp_packet)
Process the SNMP packet and prepares the response.
void snmp_mib_init(void)
Initialize the MIB resources list.
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_EXIT()
Exit the currently running process.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PROCESS_END()
Define the end of a process.
void process_start(struct process *p, process_data_t data)
Start a process.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_YIELD()
Yield the currently running process.
process_event_t tcpip_event
The uIP event.
struct uip_udp_conn * udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
Create a new UDP connection.
#define udp_bind(conn, port)
Bind a UDP connection to a local port.
void * uip_appdata
Pointer to the application data in the packet buffer.
#define UIP_IP_BUF
Direct access to IPv6 header.
#define uip_datalen()
The length of any incoming data that is currently available (if available) in the uip_appdata buffer.
#define uip_newdata()
Is new incoming data available?
#define UIP_BUFSIZE
The size of the uIP packet buffer.
SNMP Implementation of the protocol engine.
SNMP Implementation of the MIB.
SNMP Implementation of the process.
uint8_t * in
The pointer used for the incoming packet.
uint8_t * out
The pointer used for the outgoing packet.
uint16_t max
The maximum number of bytes.
uint16_t used
The number of bytes used.
Representation of a uIP UDP connection.
uint16_t lport
The local port number in network byte order.