AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/samples/demo_netxduo_snmp.c
void    tx_application_define(void *first_unused_memory)
{

UCHAR   *pointer;
UINT    status;


    /* Setup the working pointer.  */
    pointer =  (UCHAR *) first_unused_memory;

    status = tx_thread_create(&thread_0, "agent thread", thread_agent_entry, 0,  
            pointer, DEMO_STACK_SIZE, 
            4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
    if (status != NX_SUCCESS)
    {
         return;
    }

    pointer =  pointer + DEMO_STACK_SIZE;


    /* Initialize the NetX system.  */
    nx_system_initialize();

    /* Create packet pool.  */
    status = nx_packet_pool_create(&pool_0, "NetX Packet Pool 0", 2048, pointer, 20000);

    if (status != NX_SUCCESS)
    {
         return;
    }

    pointer = pointer + 20000;

    /* Create an IP instance.  */
    status = nx_ip_create(&ip_0, "SNMP Agent IP Instance", AGENT_PRIMARY_ADDRESS, 
                        0xFFFFFF00UL, &pool_0, _nx_ram_network_driver,
                        pointer, 4096, 1);

    if (status != NX_SUCCESS)
    {
         return;
    }

    pointer =  pointer + 4096;

#ifndef NX_DISABLE_IPV4
    /* Enable ARP and supply ARP cache memory for IP Instance 0.  */
    nx_arp_enable(&ip_0, (void *) pointer, 1024);
    pointer = pointer + 1024;

    /* Enable ICMP for ping.  */
    nx_icmp_enable(&ip_0);
#endif /* NX_DISABLE_IPV4  */
  
    /* Enable UPD processing for IP instance.  */
    nx_udp_enable(&ip_0);

    /* Create an SNMP agent instance.  */
    status = nx_snmp_agent_create(&my_agent, "SNMP Agent", &ip_0, pointer, 4096, &pool_0, 
                                  mib2_username_processing, mib2_get_processing, mib2_getnext_processing, 
                                  mib2_set_processing);

    if (status != NX_SUCCESS)
    {
         return;
    }

    pointer =  pointer + 4096;

#ifdef NX_SNMP_DISABLE_V3
    status = nx_snmp_agent_context_engine_set(&my_agent, context_engine_id, context_engine_size);

    if (status != NX_SUCCESS)
    {
         error_counter++;
    }
#endif /* NX_SNMP_DISABLE_V3 */

    return;
}
/* Define what the initial system looks like.  */
Define what the initial system looks like.
Define what the initial system looks like .
void    tx_application_define(void *first_unused_memory)
{
UCHAR   *pointer;
UINT    status;
    pointer =  (UCHAR *) first_unused_memory;
    status = tx_thread_create(&thread_0, "agent thread", thread_agent_entry, 0,  
            pointer, DEMO_STACK_SIZE, 
            4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
    if (status != NX_SUCCESS)
    {
         return;
    }
    pointer =  pointer + DEMO_STACK_SIZE;
    nx_system_initialize();
    status = nx_packet_pool_create(&pool_0, "NetX Packet Pool 0", 2048, pointer, 20000);
    if (status != NX_SUCCESS)
    {
         return;
    }
    pointer = pointer + 20000;
    status = nx_ip_create(&ip_0, "SNMP Agent IP Instance", AGENT_PRIMARY_ADDRESS, 
                        0xFFFFFF00UL, &pool_0, _nx_ram_network_driver,
                        pointer, 4096, 1);
    if (status != NX_SUCCESS)
    {
         return;
    }
    pointer =  pointer + 4096;
#ifndef NX_DISABLE_IPV4
    nx_arp_enable(&ip_0, (void *) pointer, 1024);
    pointer = pointer + 1024;
    nx_icmp_enable(&ip_0);
#endif 
    nx_udp_enable(&ip_0);
    status = nx_snmp_agent_create(&my_agent, "SNMP Agent", &ip_0, pointer, 4096, &pool_0, 
                                  mib2_username_processing, mib2_get_processing, mib2_getnext_processing, 
                                  mib2_set_processing);
    if (status != NX_SUCCESS)
    {
         return;
    }
    pointer =  pointer + 4096;
#ifdef NX_SNMP_DISABLE_V3
    status = nx_snmp_agent_context_engine_set(&my_agent, context_engine_id, context_engine_size);
    if (status != NX_SUCCESS)
    {
         error_counter++;
    }
#endif 
    return;
}
void tx_application_define ( void * first_unused_memory ) { UCHAR * pointer ; UINT status ; pointer = ( UCHAR * ) first_unused_memory ; status = tx_thread_create ( & thread_0 , " " , thread_agent_entry , 0 , pointer , DEMO_STACK_SIZE , 4 , 4 , TX_NO_TIME_SLICE , TX_AUTO_START ) ; if ( status != NX_SUCCESS ) { return ; } pointer = pointer + DEMO_STACK_SIZE ; nx_system_initialize ( ) ; status = nx_packet_pool_create ( & pool_0 , " " , 2048 , pointer , 20000 ) ; if ( status != NX_SUCCESS ) { return ; } pointer = pointer + 20000 ; status = nx_ip_create ( & ip_0 , " " , AGENT_PRIMARY_ADDRESS , 0xFFFFFF00UL , & pool_0 , _nx_ram_network_driver , pointer , 4096 , 1 ) ; if ( status != NX_SUCCESS ) { return ; } pointer = pointer + 4096 ; #ifndef NX_DISABLE_IPV4 nx_arp_enable ( & ip_0 , ( void * ) pointer , 1024 ) ; pointer = pointer + 1024 ; nx_icmp_enable ( & ip_0 ) ; #endif nx_udp_enable ( & ip_0 ) ; status = nx_snmp_agent_create ( & my_agent , " " , & ip_0 , pointer , 4096 , & pool_0 , mib2_username_processing , mib2_get_processing , mib2_getnext_processing , mib2_set_processing ) ; if ( status != NX_SUCCESS ) { return ; } pointer = pointer + 4096 ; #ifdef NX_SNMP_DISABLE_V3 status = nx_snmp_agent_context_engine_set ( & my_agent , context_engine_id , context_engine_size ) ; if ( status != NX_SUCCESS ) { error_counter ++ ; } #endif return ; }
Define what the initial system looks like.
Define what the initial system looks like .
/* Setup the working pointer.  */ /* Initialize the NetX system.  */ /* Create packet pool.  */ /* Create an IP instance.  */ /* Enable ARP and supply ARP cache memory for IP Instance 0.  */ /* Enable ICMP for ping.  */ /* NX_DISABLE_IPV4  */ /* Enable UPD processing for IP instance.  */ /* Create an SNMP agent instance.  */ /* NX_SNMP_DISABLE_V3 */