#include "snmp_impl.h"#include "tools.h"#include "data_list.h"Go to the source code of this file.
Data Structures | |
| struct | _set_info |
| struct | agent_request_info_s |
| struct | agent_snmp_session |
| struct | request_info_s |
| struct | tree_cache_s |
Defines | |
| #define | SNMP_MAX_PDU_SIZE 64000 |
| #define | AUTO_FREE_STATEREF 0x01 |
| #define | AUTO_FREE_OLDDATA 0x02 |
| #define | AUTO_UNDO 0x03 |
| #define | MODE_GET SNMP_MSG_GET |
| #define | MODE_GETNEXT SNMP_MSG_GETNEXT |
| #define | MODE_GETBULK SNMP_MSG_GETBULK |
| #define | MODE_IS_GET(x) (x == SNMP_MSG_GET || x == SNMP_MSG_GETNEXT || x == SNMP_MSG_GETBULK) |
| #define | MODE_SET_BEGIN SNMP_MSG_INTERNAL_SET_BEGIN |
| #define | MODE_SET_RESERVE1 SNMP_MSG_INTERNAL_SET_RESERVE1 |
| #define | MODE_SET_RESERVE2 SNMP_MSG_INTERNAL_SET_RESERVE2 |
| #define | MODE_SET_ACTION SNMP_MSG_INTERNAL_SET_ACTION |
| #define | MODE_SET_COMMIT SNMP_MSG_INTERNAL_SET_COMMIT |
| #define | MODE_SET_FREE SNMP_MSG_INTERNAL_SET_FREE |
| #define | MODE_SET_UNDO SNMP_MSG_INTERNAL_SET_UNDO |
| #define | MODE_IS_SET(x) (!MODE_IS_GET(x)) |
Typedefs | |
| typedef request_info_s | request_info |
| typedef _set_info | set_info |
| typedef tree_cache_s | tree_cache |
| typedef agent_request_info_s | agent_request_info |
Functions | |
| void | snmp_addrcache_initialise (void) |
| void | snmp_addrcache_age (void) |
| int | handle_snmp_packet (int, struct snmp_session *, int, struct snmp_pdu *, void *) |
| handles an incoming SNMP packet into the agent. More... | |
| int | handle_next_pass (struct agent_snmp_session *) |
| int | handle_var_list (struct agent_snmp_session *) |
| int | handle_one_var (struct agent_snmp_session *, struct variable_list *varbind_ptr) |
| void | snmp_agent_parse_config (char *, char *) |
| agent_snmp_session * | init_agent_snmp_session (struct snmp_session *, struct snmp_pdu *) |
| void | free_agent_snmp_session (struct agent_snmp_session *) |
| void | remove_and_free_agent_snmp_session (struct agent_snmp_session *asp) |
| int | getNextSessID (void) |
| void | dump_sess_list (void) |
| int | init_master_agent (void) |
| int | agent_check_and_process (int block) |
| agent_snmp_session * | get_current_agent_session (void) |
| void | check_outstanding_agent_requests (int status) |
| int | set_mode_request_error (int mode, request_info *request, int error_value) |
| int | set_request_error (agent_request_info *reqinfo, request_info *request, int error_value) |
| int | set_all_requests_error (agent_request_info *reqinfo, request_info *requests, int error_value) |
| int | marker_uptime (marker_t pm) |
| int | timeval_uptime (struct timeval *tv) |
| int | get_agent_uptime (void) |
| int | check_transaction_id (int transaction_id) |
| Decide if the requested transaction_id is still being processed within the agent. More... | |
| int | snmp_check_packet (struct snmp_session *, struct _snmp_transport *, void *, int) |
| int | snmp_check_parse (struct snmp_session *, struct snmp_pdu *, int) |
| int | register_agent_nsap (struct _snmp_transport *t) |
| void | deregister_agent_nsap (int handle) |
| void | agent_add_list_data (agent_request_info *agent, data_list *node) |
| void * | agent_get_list_data (agent_request_info *agent, const char *name) |
| void | free_agent_data_set (agent_request_info *agent) |
| void | free_agent_data_sets (agent_request_info *agent) |
| void | free_agent_request_info (agent_request_info *ari) |
Variables | |
| int | log_addresses |
| int | lastAddrAge |
|
|
Definition at line 55 of file snmp_agent.h. |
|
|
Definition at line 54 of file snmp_agent.h. |
|
|
Definition at line 56 of file snmp_agent.h. |
|
|
Definition at line 66 of file snmp_agent.h. |
|
|
Definition at line 68 of file snmp_agent.h. |
|
|
Definition at line 67 of file snmp_agent.h. |
|
|
Definition at line 69 of file snmp_agent.h. |
|
|
Definition at line 78 of file snmp_agent.h. Referenced by add_varbind_to_cache(), create_subtree_cache(), table_array_helper_handler(), table_data_set_helper_handler(), and table_helper_handler().
|
|
|
Definition at line 74 of file snmp_agent.h. |
|
|
Definition at line 71 of file snmp_agent.h. |
|
|
Definition at line 75 of file snmp_agent.h. |
|
|
Definition at line 76 of file snmp_agent.h. |
|
|
Definition at line 72 of file snmp_agent.h. |
|
|
Definition at line 73 of file snmp_agent.h. |
|
|
Definition at line 77 of file snmp_agent.h. |
|
|
Definition at line 18 of file snmp_agent.h. |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 1939 of file snmp_agent.c. Referenced by process_set_requests().
01940 {
01941 if (ari) {
01942 if (ari->agent_data)
01943 add_list_data(&ari->agent_data, node);
01944 else
01945 ari->agent_data = node;
01946 }
01947 }
|
|
|
Definition at line 256 of file snmp_agent.c. 00256 {
00257 int numfds;
00258 fd_set fdset;
00259 struct timeval timeout = { LONG_MAX, 0 }, *tvp = &timeout;
00260 int count;
00261 int fakeblock=0;
00262
00263 numfds = 0;
00264 FD_ZERO(&fdset);
00265 snmp_select_info(&numfds, &fdset, tvp, &fakeblock);
00266 if (block != 0 && fakeblock != 0) {
00267 /* There are no alarms registered, and the caller asked for blocking, so
00268 let select() block forever. */
00269
00270 tvp = NULL;
00271 } else if (block != 0 && fakeblock == 0) {
00272 /* The caller asked for blocking, but there is an alarm due sooner than
00273 LONG_MAX seconds from now, so use the modified timeout returned by
00274 snmp_select_info as the timeout for select(). */
00275
00276 } else if (block == 0) {
00277 /* The caller does not want us to block at all. */
00278
00279 tvp->tv_sec = 0;
00280 tvp->tv_usec = 0;
00281 }
00282
00283 count = select(numfds, &fdset, 0, 0, tvp);
00284
00285 if (count > 0) {
00286 /* packets found, process them */
00287 snmp_read(&fdset);
00288 } else switch(count) {
00289 case 0:
00290 snmp_timeout();
00291 break;
00292 case -1:
00293 if (errno != EINTR) {
00294 snmp_log_perror("select");
00295 }
00296 return -1;
00297 default:
00298 snmp_log(LOG_ERR, "select returned %d\n", count);
00299 return -1;
00300 } /* endif -- count>0 */
00301
00302 /* Run requested alarms. */
00303 run_alarms();
00304
00305 return count;
00306 }
|
|
||||||||||||
|
Definition at line 1950 of file snmp_agent.c. Referenced by table_helper_handler().
01951 {
01952 if (ari)
01953 return get_list_data(ari->agent_data,name);
01954 return NULL;
01955 }
|
|
|
Definition at line 1455 of file snmp_agent.c. Referenced by main().
01455 {
01456 struct agent_snmp_session *asp, *prev_asp = NULL, *next_asp = NULL;
01457
01458 for(asp = agent_delegated_list; asp; prev_asp = asp, asp = next_asp) {
01459 next_asp = asp->next; /* save in case we clean up asp */
01460 if (!check_for_delegated(asp)) {
01461
01462 /* we're done with this one, remove from queue */
01463 if (prev_asp != NULL)
01464 prev_asp->next = asp->next;
01465 else
01466 agent_delegated_list = asp->next;
01467
01468 /* continue processing or finish up */
01469 check_delayed_request(asp);
01470 }
01471 }
01472 }
|
|
|
Decide if the requested transaction_id is still being processed within the agent. This is used to validate whether a delayed cache (containing possibly freed pointers) is still usable. returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. Definition at line 1480 of file snmp_agent.c. Referenced by handler_check_cache().
01481 {
01482 struct agent_snmp_session *asp, *prev_asp = NULL;
01483
01484 for(asp = agent_delegated_list; asp; prev_asp = asp, asp = asp->next) {
01485 if (asp->pdu->transid == transaction_id)
01486 return SNMPERR_SUCCESS;
01487 }
01488 return SNMPERR_GENERR;
01489 }
|
|
|
Definition at line 580 of file snmp_agent.c. 00581 {
00582 agent_nsap *a = NULL, **prevNext = &agent_nsap_list;
00583 int main_session_deregistered = 0;
00584
00585 DEBUGMSGTL(("deregister_agent_nsap", "handle %d\n", handle));
00586
00587 for (a = agent_nsap_list; a != NULL && a->handle < handle; a = a->next) {
00588 prevNext = &(a->next);
00589 }
00590
00591 if (a != NULL && a->handle == handle) {
00592 *prevNext = a->next;
00593 if (main_session == snmp_sess_session(a->s)) {
00594 main_session_deregistered = 1;
00595 }
00596 snmp_close(snmp_sess_session(a->s));
00597 /* The above free()s the transport and session pointers. */
00598 free(a);
00599 }
00600
00601 /* If we've deregistered the session that main_session used to point to,
00602 then make it point to another one, or in the last resort, make it equal
00603 to NULL. Basically this shouldn't ever happen in normal operation
00604 because main_session starts off pointing at the first session added by
00605 init_master_agent(), which then discards the handle. */
00606
00607 if (main_session_deregistered) {
00608 if (agent_nsap_list != NULL) {
00609 DEBUGMSGTL(("snmp_agent",
00610 "WARNING: main_session pointer changed from %p to %p\n",
00611 main_session, snmp_sess_session(agent_nsap_list->s)));
00612 main_session = snmp_sess_session(agent_nsap_list->s);
00613 } else {
00614 DEBUGMSGTL(("snmp_agent",
00615 "WARNING: main_session pointer changed from %p to NULL\n",
00616 main_session));
00617 main_session = NULL;
00618 }
00619 }
00620 }
|
|
|
Definition at line 972 of file snmp_agent.c. 00973 {
00974 struct agent_snmp_session *a;
00975
00976 DEBUGMSGTL(("snmp_agent", "DUMP agent_sess_list -> "));
00977 for (a = agent_session_list; a != NULL; a = a->next) {
00978 DEBUGMSG(("snmp_agent", "%08p[session %08p] -> ", a, a->session));
00979 }
00980 DEBUGMSG(("snmp_agent", "[NIL]\n"));
00981 }
|
|
|
Definition at line 1958 of file snmp_agent.c. 01959 {
01960 if (ari)
01961 free_list_data(ari->agent_data);
01962 }
|
|
|
Definition at line 1965 of file snmp_agent.c. Referenced by table_helper_handler().
01966 {
01967 if (ari)
01968 free_all_list_data(ari->agent_data);
01969 }
|
|
|
Definition at line 1972 of file snmp_agent.c. Referenced by free_agent_snmp_session().
01973 {
01974 if (ari) {
01975 if (ari->agent_data)
01976 free_all_list_data(ari->agent_data);
01977 free(ari);
01978 }
01979 }
|
|
|
Definition at line 840 of file snmp_agent.c. Referenced by free_agent_snmp_session_by_session(), and remove_and_free_agent_snmp_session().
00841 {
00842 if (!asp)
00843 return;
00844 if (asp->orig_pdu)
00845 snmp_free_pdu(asp->orig_pdu);
00846 if (asp->pdu)
00847 snmp_free_pdu(asp->pdu);
00848 if (asp->reqinfo)
00849 free_agent_request_info(asp->reqinfo);
00850 if (asp->treecache) {
00851 delete_subtree_cache(asp);
00852 free(asp->treecache);
00853 }
00854 free(asp);
00855 }
|
|
|
Definition at line 248 of file snmp_agent.c. 00249 {
00250 static int SessionID = 0;
00251
00252 return ++SessionID;
00253 }
|
|
|
Definition at line 1928 of file snmp_agent.c. 01928 {
01929
01930 struct timeval now;
01931 gettimeofday(&now, NULL);
01932
01933 return timeval_uptime( &now );
01934 }
|
|
|
Definition at line 22 of file old_api.c. Referenced by old_api_helper().
00022 {
00023 return current_agent_session;
00024 }
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||||||
|
handles an incoming SNMP packet into the agent.
Definition at line 1030 of file snmp_agent.c. 01032 {
01033 struct agent_snmp_session *asp;
01034 int status, access_ret;
01035 struct variable_list *var_ptr;
01036
01037 /* we only support receiving here */
01038 if (op != SNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
01039 return 1;
01040 }
01041
01042 /* new request */
01043 asp = init_agent_snmp_session( session, pdu );
01044 status = SNMP_ERR_NOERROR;
01045
01046 /* initial access check. Is request user/community allowed to do
01047 anything at all? If not, abondon all hope here. */
01048 if ((access_ret = check_access(pdu)) != 0) {
01049 if (access_ret == VACM_NOSUCHCONTEXT) {
01050 /* rfc2573 section 3.2, step 5 says that we increment the
01051 counter but don't return a response of any kind */
01052
01053 /* we currently don't support unavailable contexts, as
01054 there is no reason to that I currently know of */
01055 snmp_increment_statistic(STAT_SNMPUNKNOWNCONTEXTS);
01056
01057 /* drop the request */
01058 remove_and_free_agent_snmp_session( asp );
01059 return 0;
01060 } else {
01061 /* access control setup is incorrect */
01062 send_easy_trap(SNMP_TRAP_AUTHFAIL, 0);
01063 if (asp->pdu->version != SNMP_VERSION_1 &&
01064 asp->pdu->version != SNMP_VERSION_2c) {
01065 asp->pdu->errstat = SNMP_ERR_AUTHORIZATIONERROR;
01066 asp->pdu->command = SNMP_MSG_RESPONSE;
01067 snmp_increment_statistic(STAT_SNMPOUTPKTS);
01068 if (! snmp_send( asp->session, asp->pdu ))
01069 snmp_free_pdu(asp->pdu);
01070 asp->pdu = NULL;
01071 remove_and_free_agent_snmp_session(asp);
01072 return 1;
01073 } else {
01074 /* drop the request */
01075 remove_and_free_agent_snmp_session( asp );
01076 return 0;
01077 }
01078 }
01079 }
01080
01081 /* process the request */
01082 status = handle_pdu(asp);
01083
01084 /* print the results in approrpiate debugging mode */
01085 DEBUGIF("results") {
01086 DEBUGMSGTL(("results","request results (status = %d): \n", status));
01087 for(var_ptr = asp->pdu->variables; var_ptr;
01088 var_ptr = var_ptr->next_variable) {
01089 char buf[SPRINT_MAX_LEN];
01090 sprint_variable(buf, var_ptr->name, var_ptr->name_length, var_ptr);
01091 DEBUGMSGTL(("results"," %s\n", buf));
01092 }
01093 }
01094
01095 /* check for uncompleted requests */
01096 if (check_for_delegated(asp)) {
01097 /* add to delegated request chain */
01098 asp->status = status;
01099 asp->next = agent_delegated_list;
01100 agent_delegated_list = asp;
01101 } else {
01102 /* if we don't have anything outstanding (delegated), wrap up */
01103 return wrap_up_request(asp, status);
01104 }
01105
01106 /* done */
01107 DEBUGMSGTL(("snmp_agent", "end of handle_snmp_packet, asp = %08p\n", asp));
01108 return 1;
01109 }
|
|
|
|
|
||||||||||||
|
Definition at line 812 of file snmp_agent.c. Referenced by handle_snmp_packet().
00813 {
00814 struct agent_snmp_session *asp;
00815
00816 asp = (struct agent_snmp_session *) calloc(1, sizeof( struct agent_snmp_session ));
00817
00818 if ( asp == NULL )
00819 return NULL;
00820 asp->session = session;
00821 asp->pdu = snmp_clone_pdu(pdu);
00822 asp->orig_pdu = snmp_clone_pdu(pdu);
00823 asp->rw = READ;
00824 asp->exact = TRUE;
00825 asp->next = NULL;
00826 asp->mode = RESERVE1;
00827 asp->status = SNMP_ERR_NOERROR;
00828 asp->index = 0;
00829
00830 asp->start = asp->pdu->variables;
00831 asp->end = asp->pdu->variables;
00832 if ( asp->end != NULL )
00833 while ( asp->end->next_variable != NULL )
00834 asp->end = asp->end->next_variable;
00835
00836 return asp;
00837 }
|
|
|
Definition at line 648 of file snmp_agent.c. 00649 {
00650 snmp_transport *transport;
00651 char *cptr, *cptr2;
00652 char buf[SPRINT_MAX_LEN];
00653
00654 if (ds_get_boolean(DS_APPLICATION_ID, DS_AGENT_ROLE) != MASTER_AGENT) {
00655 DEBUGMSGTL(("snmp_agent", "init_master_agent; not master agent\n"));
00656 return 0; /* No error if ! MASTER_AGENT */
00657 }
00658
00659 #ifdef USING_AGENTX_MASTER_MODULE
00660 if ( ds_get_boolean(DS_APPLICATION_ID, DS_AGENT_AGENTX_MASTER) == 1 )
00661 real_init_master();
00662 #endif
00663
00664 /* Have specific agent ports been specified? */
00665 cptr = ds_get_string(DS_APPLICATION_ID, DS_AGENT_PORTS);
00666
00667 if (cptr) {
00668 sprintf(buf, "%s", cptr);
00669 } else {
00670 /* No, so just specify the default port. */
00671 if (ds_get_int(DS_APPLICATION_ID, DS_AGENT_FLAGS) &
00672 SNMP_FLAGS_STREAM_SOCKET) {
00673 sprintf(buf, "tcp:%d", SNMP_PORT);
00674 } else {
00675 sprintf(buf, "udp:%d", SNMP_PORT);
00676 }
00677 }
00678
00679 DEBUGMSGTL(("snmp_agent", "final port spec: %s\n", buf));
00680 cptr = strtok(buf, ",");
00681 while (cptr) {
00682 /* Specification format:
00683
00684 NONE: (a pseudo-transport)
00685 UDP:[address:]port (also default if no transport is specified)
00686 TCP:[address:]port (if supported)
00687 Unix:pathname (if supported)
00688 AAL5PVC:itf.vpi.vci (if supported)
00689 IPX:[network]:node[/port] (if supported)
00690
00691 */
00692
00693 DEBUGMSGTL(("snmp_agent", "installing master agent on port %s\n", cptr));
00694
00695 if (!cptr || !(*cptr)) {
00696 snmp_log(LOG_ERR, "improper port specification\n");
00697 return 1;
00698 }
00699
00700 /* Transport type specifier? */
00701
00702 if ((cptr2 = strchr(cptr, ':')) != NULL) {
00703 if (strncasecmp(cptr, "none", 4) == 0) {
00704 DEBUGMSGTL(("snmp_agent",
00705 "init_master_agent; pseudo-transport \"none\" requested\n"));
00706 return 0;
00707 } else if (strncasecmp(cptr, "tcp", 3) == 0) {
00708 #ifdef SNMP_TRANSPORT_TCP_DOMAIN
00709 struct sockaddr_in addr;
00710 if (snmp_sockaddr_in(&addr, cptr2+1, 0)) {
00711 transport = snmp_tcp_transport(&addr, 1);
00712 } else {
00713 snmp_log(LOG_ERR,
00714 "Badly formatted IP address (should be [a.b.c.d:]p)\n");
00715 return 1;
00716 }
00717 #else
00718 snmp_log(LOG_ERR, "No support for requested TCP domain\n");
00719 return 1;
00720 #endif
00721 } else if (strncasecmp(cptr, "ipx", 3) == 0) {
00722 #ifdef SNMP_TRANSPORT_IPX_DOMAIN
00723 struct sockaddr_ipx addr;
00724 if (snmp_sockaddr_ipx(&addr, cptr2+1)) {
00725 transport = snmp_ipx_transport(&addr, 1);
00726 } else {
00727 snmp_log(LOG_ERR,
00728 "Badly formatted IPX address (should be [net]:node[/port])\n");
00729 return 1;
00730 }
00731 #else
00732 snmp_log(LOG_ERR, "No support for requested IPX domain\n");
00733 #endif
00734 } else if (strncasecmp(cptr, "aal5pvc", 7) == 0) {
00735 #ifdef SNMP_TRANSPORT_AAL5PVC_DOMAIN
00736 struct sockaddr_atmpvc addr;
00737 if (sscanf(cptr2+1, "%d.%d.%d", &(addr.sap_addr.itf),
00738 &(addr.sap_addr.vpi), &(addr.sap_addr.vci))==3) {
00739 addr.sap_family = AF_ATMPVC;
00740 transport = snmp_aal5pvc_transport(&addr, 1);
00741 } else {
00742 snmp_log(LOG_ERR,
00743 "Badly formatted AAL5 PVC address (should be itf.vpi.vci)\n");
00744 return 1;
00745 }
00746 #else
00747 snmp_log(LOG_ERR, "No support for requested AAL5 PVC domain\n");
00748 return 1;
00749 #endif
00750 } else if (strncasecmp(cptr, "unix", 4) == 0) {
00751 #ifdef SNMP_TRANSPORT_UNIX_DOMAIN
00752 struct sockaddr_un addr;
00753 addr.sun_family = AF_UNIX;
00754 strncpy(addr.sun_path, cptr2+1,
00755 sizeof(addr) - (size_t) (((struct sockaddr_un *)0)->sun_path));
00756 transport = snmp_unix_transport(&addr, 1);
00757 #else
00758 snmp_log(LOG_ERR, "No support for requested Unix domain\n");
00759 return 1;
00760 #endif
00761 } else if (strncasecmp(cptr, "udp", 3) == 0) {
00762 struct sockaddr_in addr;
00763 if (snmp_sockaddr_in(&addr, cptr2+1, 0)) {
00764 transport = snmp_udp_transport(&addr, 1);
00765 } else {
00766 snmp_log(LOG_ERR,
00767 "Badly formatted IP address (should be [a.b.c.d:]p)\n");
00768 return 1;
00769 }
00770 } else {
00771 snmp_log(LOG_ERR, "Unknown transport domain \"%s\"\n", cptr);
00772 return 1;
00773 }
00774 } else {
00775 /* No transport type specifier; default to UDP. */
00776 struct sockaddr_in addr;
00777 if (snmp_sockaddr_in(&addr, cptr, 0)) {
00778 transport = snmp_udp_transport(&addr, 1);
00779 } else {
00780 snmp_log(LOG_ERR,
00781 "Badly formatted IP address (should be [a.b.c.d:]p)\n");
00782 return 1;
00783 }
00784 }
00785
00786 if (transport == NULL) {
00787 snmp_log(LOG_ERR, "Error opening specified transport \"%s\"\n", cptr);
00788 return 1;
00789 }
00790
00791 if (register_agent_nsap(transport) == 0) {
00792 snmp_log(LOG_ERR,
00793 "Error registering specified transport \"%s\" as an agent NSAP\n",
00794 cptr);
00795 return 1;
00796 } else {
00797 DEBUGMSGTL(("snmp_agent",
00798 "init_master_agent; \"%s\" registered as an agent NSAP\n",
00799 cptr));
00800 }
00801
00802 /* Next transport please... */
00803 cptr = strtok(NULL, ",");
00804 }
00805
00806 return 0;
00807 }
|
|
|
Definition at line 1911 of file snmp_agent.c. Referenced by timeval_uptime().
01912 {
01913 int res;
01914 marker_t start = (marker_t)&starttime;
01915
01916 res = atime_diff( start, pm );
01917 return res/10; /* atime_diff works in msec, not csec */
01918 }
|
|
|
Referenced by init_master_agent().
|
|
|
Definition at line 984 of file snmp_agent.c. Referenced by handle_snmp_packet(), and wrap_up_request().
00985 {
00986 struct agent_snmp_session *a, **prevNext = &agent_session_list;
00987
00988 DEBUGMSGTL(("snmp_agent", "REMOVE %08p\n", asp));
00989
00990 for (a = agent_session_list; a != NULL; a = *prevNext) {
00991 if (a == asp) {
00992 *prevNext = a->next;
00993 a->next = NULL;
00994 free_agent_snmp_session(a);
00995 asp = NULL;
00996 break;
00997 } else {
00998 prevNext = &(a->next);
00999 }
01000 }
01001
01002 if (a == NULL && asp != NULL) {
01003 /* We coulnd't find it on the list, so free it anyway. */
01004 free_agent_snmp_session(asp);
01005 }
01006 }
|
|
||||||||||||||||
|
Definition at line 1898 of file snmp_agent.c. Referenced by multiplexer_helper_handler(), null_handler(), and read_only_helper().
01899 {
01900 while(requests) {
01901 set_request_error(reqinfo, requests, error_value);
01902 requests = requests->next;
01903 }
01904 return error_value;
01905 }
|
|
||||||||||||||||
|
Definition at line 1853 of file snmp_agent.c. Referenced by set_request_error().
01854 {
01855 if (!request)
01856 return error_value;
01857
01858 request->processed = 1;
01859
01860 switch(error_value) {
01861 case SNMP_NOSUCHOBJECT:
01862 case SNMP_NOSUCHINSTANCE:
01863 case SNMP_ENDOFMIBVIEW:
01864 /* these are exceptions that should be put in the varbind
01865 in the case of a GET but should be translated for a SET
01866 into a real error status code and put in the request */
01867 switch (mode) {
01868 case MODE_GET:
01869 request->requestvb->type = error_value;
01870 return error_value;
01871
01872 case MODE_GETNEXT:
01873 case MODE_GETBULK:
01874 /* ignore these. They're illegal to set by the
01875 client APIs for these modes */
01876 return error_value;
01877
01878 default:
01879 request->status = SNMP_ERR_NOSUCHNAME; /* WWW: correct? */
01880 return error_value;
01881 }
01882 break; /* never get here */
01883
01884 default:
01885 if (request->status < 0) {
01886 /* illegal local error code. translate to generr */
01887 /* WWW: full translation map? */
01888 request->status = SNMP_ERR_GENERR;
01889 } else {
01890 /* WWW: translations and mode checking? */
01891 request->status = error_value;
01892 }
01893 return error_value;
01894 }
01895 return error_value;
01896 }
|
|
||||||||||||||||
|
Definition at line 1845 of file snmp_agent.c. Referenced by call_handlers(), group_requests(), instance_counter32_handler(), instance_helper_handler(), instance_long_handler(), instance_ulong_handler(), old_api_helper(), process_get_requests(), set_all_requests_error(), table_data_set_helper_handler(), and table_helper_handler().
01846 {
01847 if (!request || !reqinfo)
01848 return error_value;
01849
01850 return set_mode_request_error(reqinfo->mode, request, error_value);
01851 }
|
|
|
Definition at line 325 of file snmp_agent.c. 00326 {
00327 int i = 0;
00328
00329 lastAddrAge = 0;
00330 for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
00331 if (addrCache[i].status == SNMP_ADDRCACHE_OLD) {
00332 addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
00333 if (addrCache[i].addr != NULL) {
00334 free(addrCache[i].addr);
00335 addrCache[i].addr = NULL;
00336 }
00337 }
00338 if (addrCache[i].status == SNMP_ADDRCACHE_USED) {
00339 addrCache[i].status = SNMP_ADDRCACHE_OLD;
00340 }
00341 }
00342 }
|
|
|
Definition at line 311 of file snmp_agent.c. 00312 {
00313 int i = 0;
00314
00315 for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
00316 addrCache[i].addr = NULL;
00317 addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
00318 }
00319 }
|
|
||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Definition at line 1921 of file snmp_agent.c. Referenced by get_agent_uptime().
01922 {
01923 return marker_uptime((marker_t)tv);
01924 }
|
|
|
Definition at line 28 of file snmp_agent.h. |
|
|
Definition at line 24 of file snmp_agent.h. |
1.2.11 written by Dimitri van Heesch,
© 1997-2001
[an error occurred while processing this directive]
[an error occurred while processing this directive]
Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.