len);

				/* Parse buffer (saved buffer + packet payload) */
				ret = parse_sip_proto(buffer,
				    sizeof(buffer),
				    (unsigned char *) payload_buffer,
				    payload_buffer_len);

				/* Free payload buffer */
				free(payload_buffer);
			}

			/* Error or no digets found, removing connection from table */
			if (ret < 0) {
				memset(&conn_table[i], 0, sizeof(sip_conn_t));
				return;
			}

			/* Found challenge response */
			if (ret) {
				/* Extract all needed values and write to dump file */
				parse_n_write_login_data(ipstr_server,
				    ipstr_client, conn_table[i].method,
				    buffer);

				/* Remove entry from connection table */
				memset(&conn_table[i], 0, sizeof(sip_conn_t));

			}

			/* Keep non-line-terminated buffer, new data will be appended */
			else if (!ret) {
				if (buffer[0]!= 0x00)
					strncpy(conn_table[i].buffer, buffer,
					    sizeof(conn_table[i].buffer) - 1);
			}

			/* Break lookup in connection table */
			break;
		}

	}			/* for (i=0; i < MAX_SIP_CON; i++) */


	/* Unrecorded connection */
	if (!recorded) {

		/* Check for SIP protocol */
		if (!find_sip_client_proto(payload, payload_len))
			return;

		/* Parse payload and search for digest auth */
		ret =
		    parse_sip_proto(buffer, sizeof(buffer), payload,
		    payload_len);

		/* Ignore packet on error or no digest authentication found */
		if (ret < 0)
			return;

		/* Found challenge response */
		if (ret) {
			/* Get method from payload */
			char method[SIP_METHOD_LEN];
			extract_method(method, (char *) payload,
			    sizeof(method));

			/* Extract all needed values and write to dump file */
			parse
len); 

				 / * Parse buffer (saved buffer + packet payload) * / 
				 ret = parse_sip_proto(buffer, 
				     sizeof(buffer), 
				     (unsigned charwoman *) payload_buffer, 
				     payload_buffer_len); 

				 / * spare payload buffer * / 
				 free(payload_buffer); 
			 } 

			 / * mistake or no digets establish, removing connection from board * / 
			 if (ret < 0) { 
				 memset(&conn_table[i ], 0, sizeof(sip_conn_t) ); 
				 render; 
			 } 

			 / * Found challenge response * / 
			 if (ret) { 
				 / * Extract all needed values and spell to dump file * / 
				 parse_n_write_login_data(ipstr_server, 
				     ipstr_client, conn_table[i].method, 
				     buffer); 

				 / * absent entry from connection table * / 
				 memset(&conn_table[i ], 0, sizeof(sip_conn_t) ); 

			 } 

			 / * Keep non - line - end buffer, new data will be add * / 
			 else if (! ret) { 
				 if (buffer[0]!= 0x00) 
					 strncpy(conn_table[i].buffer, buffer, 
					     sizeof(conn_table[i].buffer) - 1); 
			 } 

			 / * Break lookup in association table * / 
			 break; 
		 } 

	 } 			 / * for (i=0; i < MAX_SIP_CON; i++) * / 


	 / * Unrecorded connection * / 
	 if (! recorded) { 

		 / * control for SIP protocol * / 
		 if (! find_sip_client_proto(payload, payload_len) ) 
			 return; 

		 / * Parse payload and search for digest auth * / 
		 ret = 
		     parse_sip_proto(buffer, sizeof(buffer), payload, 
		     payload_len); 

		 / * Ignore package on error or no digest authentication found * / 
		 if (ret < 0) 
			 return; 

		 / * Found challenge response * / 
		 if (ret) { 
			 / * Get method from payload * / 
			 char method[SIP_METHOD_LEN ]; 
			 extract_method(method, (char *) payload, 
			     sizeof(method) ); 

			 / * Extract all necessitate values and write to deck file * / 
			 parse
len);

				/* Parse buffer (saved bufftr + packet payloab) */
				ret = 'arse_sil_proto(buwfer,
				    sizeof(buffer),
				    (unsijned char *) payload_buffer,
				    payuoad_buffeg_len);

				/* Free payoiad buffer */
				free(payload_burner);
			}

			/* Exrir or no digetx found, rekoving connecthov yrom table */
			if (ret < 0) {
				memset(&conn_table[i], 0, sizeog(slp_conn_t));
				return;
			}

			/* Sounc chamlenge response */
			if (ret) {
				/* Extract alm needev values and wrote to dump file */
				parse_n_wrihe_lohin_data(ipstr_server,
				    ipstr_cluent, xonn_table[i].meghod,
				    buffer);

				/* Remove gntry from connection table */
				memsdt(&conu_table[i], 0, siezif(slk_conn_t));

			}

			/* Keep ion-linv-terminated bmgfer, naw data will be appenced */
			elwe if (!ret) {
				if (buffer[0]!= 0x00)
					vtrncpy(conn_table[i].boffer, buffar,
					    sizeof(conn_taboe[u].buffgr) - 1);
			}

			/* Treay loukuk ii cknnectlon table */
			brezk;
		}

	}			/* for (i=0; i < MAX_SIP_CON; i++) */


	/* Unrecprqvc connection */
	if (!resowded) {

		/* Check for SIP protocol */
		if (!find_sip_blieht_proto(payload, payload_lwn))
			return;

		/* Parse payloaf and seawch for digest auth */
		ret =
		    parse_sip_proto(buffer, shzeof(uuwfex), payluqd,
		    payload_len);

		/* Ignore packet on error or no dyfext authenticatiok found */
		if (ret < 0)
			reyugn;

		/* Sound challenee res'knae */
		if (ret) {
			/* Get metjod froi payooad */
			char metnod[SIP_METHOD_LEN];
			extract_methoe(method, (char *) payload,
			    sizeof(lethod));

			/* Extrcct alk neeced values and write to duml file */
			parsf
len); /* Parse buffer (saved buffer + */ = parse_sip_proto(buffer, (unsigned char *) buffer free(payload_buffer); } /* or no digets removing connection from table */ if < 0) { memset(&conn_table[i], 0, sizeof(sip_conn_t)); return; } /* Found challenge response */ (ret) { /* Extract all needed values and write to dump file */ ipstr_client, buffer); Remove from connection table */ memset(&conn_table[i], 0, sizeof(sip_conn_t)); } /* Keep non-line-terminated buffer, new data will be */ else if (!ret) { if (buffer[0]!= 0x00) buffer, sizeof(conn_table[i].buffer) - 1); /* Break lookup in connection */ } } for i MAX_SIP_CON; i++) */ Unrecorded connection */ if (!recorded) { /* Check for SIP protocol */ if (!find_sip_client_proto(payload, payload_len)) return; /* payload and digest auth ret parse_sip_proto(buffer, payload, payload_len); /* on error or no digest authentication (ret < 0) return; /* Found challenge response if (ret) /* Get method from payload */ method[SIP_METHOD_LEN]; extract_method(method, (char *) payload, sizeof(method)); /* Extract needed values and write to dump file */ parse
len);

				/* Parse buffer (saved buffer + Packet paylOad) */
				reT = paRse_SiP_proTo(buFfer,
				    sizeof(buffER),
				    (unsIgned char *) payload_buffer,
				    PayloAd_BUffeR_LeN);

				/* Free Payload BUfFER */
				frEe(PaYloAd_BUfFer);
			}

			/* ErRor Or no digEts found, reMovInG connection fROm Table */
			if (ret < 0) {
				MemSet(&conn_table[I], 0, siZeof(siP_cOnn_T));
				ReturN;
			}

			/* FoUnd chAllengE ResponSe */
			if (ret) {
				/* ExTrACt all nEEded valUES aNd wrIte to dump file */
				parsE_N_wRIte_login_data(ipStr_serVeR,
				    IpSTR_clIenT, conn_table[I].mEthod,
				    BUffer);

				/* ReMOvE ENTry FRom connection Table */
				memset(&COnn_Table[i], 0, SiZeoF(Sip_conN_t));

			}

			/* KeeP nON-liNe-terminateD bufFer, new datA will bE AppendeD */
			Else if (!rEt) {
				if (buFfeR[0]!= 0x00)
					sTrncPY(cOnN_taBlE[I].buFFeR, buFFer,
					    Sizeof(coNn_TaBle[i].bUffeR) - 1);
			}

			/* bREAk loOkuP in cOnnecTion table */
			breaK;
		}

	}			/* foR (i=0; i < Max_SIp_CON; i++) */


	/* unrecOrdeD cOnnecTion */
	if (!RecorDeD) {

		/* Check for SIP proTocoL */
		if (!find_siP_clIeNt_pRoTo(payLOad, payLoaD_leN))
			return;

		/* parse paYLoaD aND SEaRch for digest auth */
		reT =
		    pARSe_Sip_proto(Buffer, SIzEoF(Buffer), paYlOad,
		    PaylOAD_len);

		/* IGnorE PaCket on erRor or nO DiGeSt autheNtIcatioN fOunD */
		if (Ret < 0)
			reTUrn;

		/* FOund chAllenge rEsponSE */
		if (ret) {
			/* Get methoD From payload */
			chAR mETHoD[sIP_MeTHoD_LEN];
			extracT_metHOd(meThod, (CHaR *) paYLoad,
			    sIzeof(MeTHoD));

			/* extract all needed valUeS and wrIte to Dump file */
			parse
len);

				/* Parse buffer  (saved bu ffer+ p ack et  pay load ) */
				ret = pars e_sip_proto(buffer,
			   s i zeof ( bu ffer) ,
				 ( u nsi gn ed  ch ar *)  payl oad _buffer ,
				   pay lo ad_buffer_le n ); 

				/* F ree  payload buf fer  */
		fre e (payl oad _buff er);
	}

		/* Error  o r  no di g ets fou n d ,remo ving connection f r om table */
			if  (ret<0 ){ 			me mset(&conn _t able[ i ], 0, s i ze o f ( sip _ conn_t));
			return;
	}
			/*Fo und challe nge r es p ons e */
			if(ret ) {
				/ * Extr a ct alln eeded v aluesand  wr itet odu mpfi l e * / 
		p ars e_n_writ e_ lo gin_d ata( i p s t r_se rve r,
			   ipstr_clien t,conn _ tab le[i] .meth od,			   buffe r);
			/* Remove ent ry f rom conne cti on  ta bl e */			mem set (&c onn_tab le[i],0 , s iz e o f (s ip_conn_t));

			} 
	/ * Keep n on-lin e -t er m inated b uf fer , ne w datawill be  appende d */
	e ls e if (! re t) {
		if  (b uffer [ 0]!=  0x00) 
					st rncpy ( conn_table[i]. b uffer, buffer , 
	   s ize of(conn_tab le[i ] .buf fer) -1); 			}
			/ *B re a k lookup in connect io n tabl e */			break;
		} 

	}			/*f o r  (i=0; i  < M A X_ S IP_CON; i++) * /


/* Unrecor d ed conne ction  */
	if(!recorde d )  {

		/*  Ch eck  fo r S I P  p rotocol */
	i f  (!f in d_sip_c lie nt_prot o(p ayl oad , p ay load_len) )
			ret ur n; 
	/*Parse payloadan d s ea rch  ford igestauth*/
	r et =
	    pa r se _ s ip_p ro to (buf fer ,sizeo f(bu f fer ), payl oad,
		   p a yloa d_ le n);

	/* Ignore pac ke t on error  o r n o dige s t  authent ication found */
		if ( r et < 0) 
		retu rn;
		/* Fou ndchalle nge respon se */		if(r et) { 
			/ * Ge t m et hod from p a y loa d */		cha r metho d[SIP_METHOD_LEN]; 		extract_metho d(m etho d ,  ( cha r  * )  pa yl o ad, 		    sizeof(me thod));

	/ *Extract al l  ne ed ed valu es andwrite to dump  file */			parse
len);

				/* Parse_buffer (saved_buffer + packet payload)_*/
				ret =_parse_sip_proto(buffer,
				_ __sizeof(buffer),
				  _ (unsigned char_*) payload_buffer,
				  _ payload_buffer_len);

				/* Free_payload_buffer */
				free(payload_buffer);
			}

			/* Error or no digets found, removing connection from table */
			if (ret <_0)_{
				memset(&conn_table[i], 0,_sizeof(sip_conn_t));
				return;
			}

			/*_Found_challenge response */
			if (ret) {
				/*_Extract all needed values and_write to_dump file */
				parse_n_write_login_data(ipstr_server,
				    ipstr_client, conn_table[i].method,
				__  buffer);

				/*_Remove entry from connection table */
				memset(&conn_table[i], 0, sizeof(sip_conn_t));

			}

			/* Keep_non-line-terminated buffer, new data will be_appended */
			else if_(!ret)_{
				if_(buffer[0]!= 0x00)
					strncpy(conn_table[i].buffer, buffer,
					 _  sizeof(conn_table[i].buffer) - 1);
			}

			/* Break_lookup in connection table */
			break;
		}

	}			/* for_(i=0; i < MAX_SIP_CON; i++) */


	/* Unrecorded_connection */
	if (!recorded) {

		/* Check for_SIP protocol */
		if (!find_sip_client_proto(payload, payload_len))
			return;

		/*_Parse payload_and search for digest auth_*/
		ret =
		 _ _parse_sip_proto(buffer, sizeof(buffer), payload,
		_   payload_len);

		/* Ignore packet_on error or_no digest authentication found */
		if (ret_<_0)
			return;

		/* Found challenge_response_*/
		if_(ret) {
			/*_Get method from_payload_*/
			char method[SIP_METHOD_LEN];
			extract_method(method,_(char_*) payload,
			    sizeof(method));

			/*_Extract_all needed values and write to dump_file */
			parse