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) 52 PROCESS(snmp_process,
"SNMP Process");
72 snmp_udp_conn =
udp_new(NULL, 0, NULL);
73 udp_bind(snmp_udp_conn, SNMP_SERVER_PORT);
74 LOG_DBG(
"Listening on port %u\n", uip_ntohs(snmp_udp_conn->
lport));
87 LOG_DBG(
"receiving UDP datagram from [");
89 LOG_DBG_(
"]:%u", uip_ntohs(UIP_UDP_BUF->srcport));
101 LOG_DBG(
"Error while handling the request\n");
105 LOG_DBG(
"Sending response\n");
107 uip_udp_packet_sendto(snmp_udp_conn, snmp_packet.
out, snmp_packet.
used, &
UIP_IP_BUF->srcipaddr, UIP_UDP_BUF->srcport);
#define UIP_IP_BUF
Direct access to IPv6 header.
SNMP Implementation of the process
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PROCESS_END()
Define the end of a process.
process_event_t tcpip_event
The uIP event.
#define UIP_BUFSIZE
The size of the uIP packet buffer.
void snmp_init()
Initializes the SNMP engine.
uint16_t lport
The local port number in network byte order.
uint8_t * in
The pointer used for the incoming packet.
uint8_t * out
The pointer used for the outgoing packet.
#define uip_newdata()
Is new incoming data available?
struct uip_udp_conn * udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
Create a new UDP connection.
uint16_t used
The number os bytes used.
#define PROCESS_YIELD()
Yield the currently running process.
void snmp_mib_init(void)
Initialize the MIB resources list.
uint16_t max
The maximum number of bytes.
PROCESS_THREAD(cc2538_rf_process, ev, data)
Implementation of the cc2538 RF driver process.
SNMP Implementation of the MIB
#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.
SNMP Implementation of the protocol engine
#define uip_datalen()
The length of any incoming data that is currently available (if available) in the uip_appdata buffer...
void process_start(struct process *p, process_data_t data)
Start a process.
int snmp_engine(snmp_packet_t *snmp_packet)
Process the SNMP packet and prepares the response.
Representation of a uIP UDP connection.