Lines Matching defs:pdu

54 #include "pdu.h"
91 static Session *session_open(Address *address, SNMP_pdu *pdu);
239 for(variable = request->pdu->first_variable; variable; variable = variable->next_variable)
255 int three_phase_protocol_in_action(SNMP_pdu *pdu)
263 if( pdu->type != SET_REQ_MSG) return(FALSE);
265 for(variable=pdu->first_variable;variable;variable=variable->next_variable){
266 subtree=subtree_match(pdu->type,&(variable->name));
289 if(s->pdu && s->pdu->type == SET_REQ_MSG) return(TRUE);
297 SNMP_pdu *pdu;
303 pdu = snmp_pdu_receive(clients_sd, &address, error_label);
304 if(pdu == NULL)
320 if(pdu->type != GET_REQ_MSG
321 && pdu->type != GETNEXT_REQ_MSG
322 && pdu->type != SET_REQ_MSG)
325 pdu->type,
327 snmp_pdu_free(pdu);
330 if(pdu->first_variable == NULL)
334 snmp_pdu_free(pdu);
339 session = session_find(&address, pdu->request_id);
347 snmp_pdu_free(pdu);
353 * create the Three Phase object, pass the pdu from the
356 if(three_phase_protocol_in_action(pdu)){
357 three_phase.origin_pdu = pdu;
358 /* create a corresponding get pdu */
359 three_phase.cur_pdu = snmp_pdu_dup(pdu, error_label);
363 snmp_pdu_free(pdu);
370 for(variable=pdu->first_variable;variable;
376 snmp_pdu_free(pdu);
379 pdu = three_phase.cur_pdu;
383 session = session_open(&address, pdu);
388 error("session_open() failed for a pdu received from %s",
433 * The pdu must have at least one variable in
437 * As the pdu is attached in a session structure,
438 * you must not free the pdu when this function
442 static Session *session_open(Address *address, SNMP_pdu *pdu)
469 session->pdu = NULL;
480 /* pdu, n_variables, o_falgs, i_flags */
481 session->pdu = pdu;
493 for(variable = pdu->first_variable; variable; variable = variable->next_variable)
509 ( (pdu->type == GETNEXT_REQ_MSG) && (SSAOidCmp(&(variable->name), &sysUptime_name) == 0) )
511 ( (pdu->type == GET_REQ_MSG) && (SSAOidCmp(&(variable->name), &sysUptime_instance) == 0) ) )
525 subtree = subtree_match(pdu->type, &(variable->name));
538 if (community_check(address, subtree->agent, pdu->type,
539 pdu->community) == FALSE) {
629 request->pdu = snmp_pdu_dup(session->pdu, error_label);
630 if(request->pdu == NULL)
636 request->pdu->request_id = session->session_id + request->request_id;
638 request->pdu->first_variable = snmp_variable_dup(variable, error_label);
639 if(request->pdu->first_variable == NULL)
665 request->response = snmp_pdu_dup(session->pdu, error_label);
736 request->pdu = NULL;
749 request->pdu = snmp_pdu_dup(session->pdu, error_label);
750 if(request->pdu == NULL)
783 /* append the new variable to the variable list of request->pdu */
784 if(request->pdu->first_variable)
790 for(current_variable = request->pdu->first_variable; current_variable; current_variable = current_variable->next_variable)
798 request->pdu->first_variable = new_variable;
897 snmp_pdu_free(session->pdu);
946 * new session(session_open) for next state. the pdu
1092 response = snmp_pdu_dup(session->pdu, error_label);
1134 SNMP_pdu *pdu = session->pdu;
1138 * change the pdu to the three_phase->origin_pdu
1142 session->pdu = three_phase.origin_pdu;
1143 pdu = session->pdu;
1149 /* set fail, the session->pdu pts to origin_pdu */
1169 pdu->type = GET_RSP_MSG;
1170 pdu->error_status = status;
1171 pdu->error_index = index;
1173 if (pdu->error_status == SNMP_ERR_AUTHORIZATIONERROR) {
1178 if( (pdu->error_status != SNMP_ERR_NOERROR)
1179 && (pdu->error_status != SNMP_ERR_NOSUCHNAME) )
1182 error_status_string(pdu->error_status), pdu->error_index,
1186 if(snmp_pdu_send(clients_sd, &(session->address), pdu, error_label))
1209 if( (session->pdu->request_id == request_id)
1225 SNMP_pdu *pdu;
1233 if(subtree == NULL || request->pdu == NULL)
1249 /* duplicate the pdu */
1250 pdu = snmp_pdu_dup(request->pdu, error_label);
1251 pdu->request_id = session->session_id + request->request_id;
1253 for(variable = request->pdu->first_variable; variable;
1257 if(pdu->first_variable)
1262 for(current_variable = pdu->first_variable;
1272 pdu->first_variable = new_variable;
1276 if (agent_process(&(session->address), pdu) == -1) {
1278 trace("local pdu process error \n");
1280 snmp_pdu_free(pdu);
1283 /* pdu stores the response */
1284 session_process_response(pdu,doRespondHere);
1294 SNMP_pdu *pdu = request->pdu;
1300 pdu->request_id = session->session_id + request->request_id;
1310 if(snmp_pdu_send(agents_sd, &(agent->address), pdu, error_label))
1387 snmp_pdu_free(request->pdu);
1478 SNMP_pdu *pdu;
1561 pdu = session->pdu;
1574 if(pdu->type == GETNEXT_REQ_MSG)
1820 if(sp->pdu->type == GETNEXT_REQ_MSG)