46 #define LOG_MODULE "SNMP" 47 #define LOG_LEVEL LOG_LEVEL_SNMP 50 #define SNMP_SERVER_PORT UIP_HTONS(SNMP_PORT) 51 PROCESS(snmp_process,
"SNMP Process");
57 snmp_process_data(
void)
60 unsigned char *packet_end;
61 static uint32_t packet_len;
63 packet_end = packet +
sizeof(packet) - 1;
66 LOG_DBG(
"receiving UDP datagram from [");
68 LOG_DBG_(
"]:%u", uip_ntohs(UIP_UDP_BUF->srcport));
75 LOG_DBG(
"Error while handling the request\n");
77 LOG_DBG(
"Sending response\n");
81 uip_udp_packet_sendto(snmp_udp_conn, packet_end, packet_len, &
UIP_IP_BUF->srcipaddr, UIP_UDP_BUF->srcport);
99 snmp_udp_conn =
udp_new(NULL, 0, NULL);
100 udp_bind(snmp_udp_conn, SNMP_SERVER_PORT);
101 LOG_DBG(
"Listening on port %u\n", uip_ntohs(snmp_udp_conn->
lport));
#define UIP_IP_BUF
Direct access to IPv6 header.
An implementation of the Simple Network Management Protocol (RFC 3411-3418)
#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.
uint16_t lport
The local port number in network byte order.
#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.
void snmp_mib_init(void)
Initialize the MIB resources list.
#define PROCESS_YIELD()
Yield the currently running process.
#define SNMP_MAX_PACKET_SIZE
Default maximum size of the packet in bytes.
void snmp_init()
Initializes the SNMP engine.
PROCESS_THREAD(cc2538_rf_process, ev, data)
Implementation of the cc2538 RF driver process.
unsigned char * snmp_engine(unsigned char *buff, uint32_t buff_len, unsigned char *out, uint32_t *out_len)
Process the SNMP packet and prepares the response.
An implementation of the Simple Network Management Protocol (RFC 3411-3418)
#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.
An implementation of the Simple Network Management Protocol (RFC 3411-3418)
#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.
Representation of a uIP UDP connection.