示例#1
0
/**---------------------------------------------------------------------------
 * Fetch a copy of the source table for a RTP session.
 * 
 * @param[in] p_session Pointer to the RTP session (unused).
 * @param[in] id Identifier of the RTP IS in the dataplane.
 * @param[out] table The most recent source table will be returned
 * in this parameter.
 * @param[out] boolean Returns true if a valid table was returned,
 * false otherwise.
 *---------------------------------------------------------------------------*/ 
boolean
vqec_rtp_session_dp_get_src_table (rtp_session_t *p_session, 
                                   vqec_dp_streamid_t id,
                                   vqec_dp_rtp_src_table_t *table)
{
    boolean ret = TRUE;
    vqec_dp_error_t err;

    if (!p_session || !table) {
        syslog_print(VQEC_INVALIDARGS, __FUNCTION__);
        ret = FALSE;
        return (ret);
    }

    err = vqec_dp_chan_rtp_input_stream_src_get_table(id, table);

    if (err != VQEC_DP_ERR_OK) {
        syslog_print(VQEC_ERROR,
                     "IPC failure for input stream source permit");
        VQEC_DEBUG(VQEC_DEBUG_UPCALL,
                   "IPC failed for input stream source table fetch: "
                   "IS id %u\n", id);
        ret = FALSE;
    }
    
    return (ret);
}
示例#2
0
/**---------------------------------------------------------------------------
 * Delete a dataplane source entry for a RTP session.
 * 
 * @param[in] p_session Pointer to the RTP session
 * @param[in] id Identifier of the RTP IS in the dataplane.
 * @param[in] source_id Attributes of the source.
 * @param[out] table [optional]If the caller needs, the most recent
 * source table will be returned in this parameter.
 * @param[out] boolean Returns true if the delete succeeded, or
 * if the source-entry was not present in the dataplane. All other cases,
 * such as null-pointers, non-existent stream in the dataplane, etc. are
 * considered failures.
 *---------------------------------------------------------------------------*/ 
boolean
vqec_rtp_session_dp_src_delete (rtp_session_t *p_session, 
                                vqec_dp_streamid_t id,
                                rtp_source_id_t *source_id,
                                vqec_dp_rtp_src_table_t *table) 
{
    boolean ret = TRUE;
    vqec_dp_rtp_src_key_t key;
    vqec_dp_error_t err;
    char str[INET_ADDRSTRLEN];

    if (!p_session || !source_id) {
        syslog_print(VQEC_INVALIDARGS, __FUNCTION__);
        ret = FALSE;
        return (ret);
    }

    memset(&key, 0, sizeof(key));
    key.ssrc = source_id->ssrc;
    key.ipv4.src_addr.s_addr = source_id->src_addr;
    key.ipv4.src_port = source_id->src_port;
        
    err = vqec_dp_chan_rtp_input_stream_src_delete(id,
                                                   &key,
                                                   table);
    if (err == VQEC_DP_ERR_NOT_FOUND) {
        VQEC_DEBUG(VQEC_DEBUG_UPCALL,
                   "Stream source delete, source entry not present in dp: "
                   "IS id: %u, source %u:%s:%d\n",
                   id, 
                   key.ssrc,
                   uint32_ntoa_r(key.ipv4.src_addr.s_addr, str, sizeof(str)), 
                   ntohs(key.ipv4.src_port));

    } else if (err != VQEC_DP_ERR_OK) {
        syslog_print(VQEC_ERROR, 
                     "IPC failure for input stream source delete"); 
        VQEC_DEBUG(VQEC_DEBUG_UPCALL,
                   "IPC failed for input stream source delete: "
                   "IS id: %u, source %u:%s:%d\n",
                   id, 
                   key.ssrc,
                   uint32_ntoa_r(key.ipv4.src_addr.s_addr, str, sizeof(str)), 
                   ntohs(key.ipv4.src_port));
        ret = FALSE;
    }
    
    return (ret);
}
/**
 * Pads buffer with NULL Transport Stream packets (if needed) to ensure
 * buffer contains a multiple of MP_NUM_TSPAKS_PER_DP_PAK TS packets.
 * 
 * @param buf_list      - Buffer to be filled
 * @param tspkt_cnt     - Number of NULL TS Packets to add
 */
mp_tlv_status_t mp_tlv_buf_pad (mp_tlv_buflist_t *buf_list,
                                int num_nulls_needed)
{
    /* Create one MPEG-TS Padding packet, it will be
       copied multiple times into the output buffers */
    char padding[MP_MPEG_TSPKT_LEN];
    int hdr_data = 0;

    hdr_data = mp_mpeg_create_hdr(MP_NULL_PACKET_PID , 0, 0,
                                  MP_TSHDR_AF_PAYLOAD_PRESENT, 0);
    memcpy(&padding, &hdr_data, sizeof(hdr_data));
    memset(&padding[4], 0xff, MP_MPEG_TSPKT_LEN-sizeof(hdr_data));

    /* 
     * Fill the output buffer with as many NULL MPEG TS packets
     * as are needed
     */
    while (buf_list->buf_rem > 0 && 
          buf_list->buf_rem >= MP_MPEG_TSPKT_LEN &&
          num_nulls_needed != 0) {
        if (mp_tlv_buf_fill(buf_list, (uint8_t *)&padding, 1) != 
            MP_MPEG_TSPKT_LEN) {
            syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                         "MP - Couldn't write all packets to buf");
            return (MP_STATUS_BUFF_TOO_SMALL);
        }
        num_nulls_needed --;
    }

    if (num_nulls_needed == 0) {
        return (MP_STATUS_TLV_SUCCESS);
    } else {
        return (MP_STATUS_BUFF_TOO_SMALL);
    }
}
/*
 *  システムログタスクの本体(受け口関数)
 */
void
eLogTaskBody_main(void)
{
	SYSLOG	syslog;
	uint_t	lost;
	ER_UINT	rercd;

	cSerialPort_open();
	syslog_0(LOG_NOTICE, "System logging task is started.");

	for (;;) {
		lost = 0U;
		while ((rercd = cSysLog_read(&syslog)) >= 0) {
			lost += (uint_t) rercd;
			if (lost > 0U) {
				syslog_lostmsg(lost, logtask_putc);
				lost = 0U;
			}
			syslog_print(&syslog, logtask_putc);
			logtask_putc('\n');
		}
		if (lost > 0U) {
			syslog_lostmsg(lost, logtask_putc);
		}
		dly_tsk(ATTR_interval);
	}
}
示例#5
0
文件: logtask.c 项目: inouema/toppers
/*
 *  システムログタスクの本体
 */
void
logtask_main(intptr_t exinf)
{
	SYSLOG	syslog;
	uint_t	lost;
	ER_UINT	rercd;
	ID my_logtask_portid;

	my_logtask_portid = (ID) exinf;
	set_my_logtask_portid(my_logtask_portid);
	serial_opn_por(my_logtask_portid);
	syslog_msk_log(LOG_UPTO(LOG_NOTICE), LOG_UPTO(LOG_EMERG));
	syslog_1(LOG_NOTICE, "System logging task is started on port %d.",
													my_logtask_portid);
	for (;;) {
		lost = 0U;
		while ((rercd = syslog_rea_log(&syslog)) >= 0) {
			lost += (uint_t) rercd;
			if (syslog.logtype >= LOG_TYPE_COMMENT) {
				if (lost > 0U) {
					syslog_lostmsg(lost, logtask_putc);
					lost = 0U;
				}
				syslog_print(&syslog, logtask_putc);
				logtask_putc('\n');
			}
		}
		if (lost > 0U) {
			syslog_lostmsg(lost, logtask_putc);
		}
		if(E_OK != dly_tsk(LOGTASK_INTERVAL)){
			syslog_0(LOG_NOTICE, "syslog : Error dly_tsk() !");
		}
	}
}
示例#6
0
/*
 *  システムログタスクの本体
 */
void
logtask_main(intptr_t exinf)
{
	SYSLOG	logbuf;
	uint_t	lostlog;
	ER_UINT	rercd;

	logtask_portid = (ID) exinf;
	(void) serial_opn_por(logtask_portid);
	(void) syslog_msk_log(LOG_UPTO(LOG_NOTICE), LOG_UPTO(LOG_EMERG));
	syslog_1(LOG_NOTICE, "System logging task is started on port %d.",
													logtask_portid);
	for (;;) {
		lostlog = 0U;
		while ((rercd = syslog_rea_log(&logbuf)) >= 0) {
			lostlog += (uint_t) rercd;
			if (logbuf.logtype >= LOG_TYPE_COMMENT) {
				if (lostlog > 0U) {
					syslog_lostmsg(lostlog, logtask_putc);
					lostlog = 0U;
				}
				syslog_print(&logbuf, logtask_putc);
				logtask_putc('\n');
			}
		}
		if (lostlog > 0U) {
			syslog_lostmsg(lostlog, logtask_putc);
		}
		(void) dly_tsk(LOGTASK_INTERVAL);
	}
}
示例#7
0
static 
void rtcp_tmevt_log_err (const char *format, ...)
{
    char buf[TMEVT_ERR_STRLEN];
    va_list ap;

    va_start(ap, format);    
    vsnprintf(buf, TMEVT_ERR_STRLEN, format, ap);
    va_end(ap);

    syslog_print(VQEC_ERROR, buf);
}
/**
 * Sets Continuity Count to correct value. The packets generated by 
 * mp_tlv_to_tspkts will be prepended to the repair burst so the 
 * CC must be decremented by 1 for each TS Pkt on a given PID.
 *
 * If correct CC cannot be found (not in PIDLIST), a CC value of zero
 * is used.  While this may be incorrect, it is preferable to failing
 * the RCC, as CCs are often not checked by STBs.
 *
 * @param pidlist               - Pointer to pidlist table
 * @param buf_list              - Contains Transport Stream Packets
 * @param tspkt_cnt             - Number of packets in buf_list
 */
void mp_correct_tspkt_cc(mp_tlv_pidlist_t *pidlist, mp_tlv_buflist_t *buf_list,
                        int tspkt_cnt){

    /* Find last used buffer in list */
    while(buf_list!=VQE_TAILQ_LAST(&vqe_tsrap_app_list_head, 
                                   vqe_tsrap_app_tailq_head_)){
       buf_list = VQE_TAILQ_NEXT(buf_list, list_entry);
    }
    while(tspkt_cnt >0 && buf_list){
        int bufpkt_cnt;

        bufpkt_cnt = (buf_list->buf_len - buf_list->buf_rem)/MP_MPEG_TSPKT_LEN;
        while(bufpkt_cnt>0){
            uint16_t pid;
            uint8_t cc, af_ctrl;
            boolean decrement_flag = TRUE;

            mp_tsheader_t *tshdr_ptr = (mp_tsheader_t *)
                ((uint32_t *)&buf_list->tspkt_buf[(bufpkt_cnt-1) *
                                                  MP_MPEG_TSPKT_LEN]);
            pid = MP_GET_TSHDR_PID(tshdr_ptr);
            af_ctrl = MP_GET_TSHDR_AF(tshdr_ptr);

            if (pid == MP_NULL_PACKET_PID) {
                goto next_ts_packet;
            }

            /* MPEG2-TS spec says CC value is not decremented when 
             * only an adaptation field and no payload is present
             */
            if (af_ctrl ==  MP_TSHDR_AF_PRESENT) {
                decrement_flag = FALSE;
            }

            if (mp_get_cc_for_pid(pidlist, pid, &cc, decrement_flag) == 
                FALSE) { 
                syslog_print(VQE_MP_TLV_ERR_PID, 
                             "MP - PID for TSRAP TS Packet not found");
                cc=0;
            }

            tshdr_ptr->ts_b4 = (tshdr_ptr->ts_b4&0xf0)| cc;  

next_ts_packet:
            bufpkt_cnt--;
            tspkt_cnt--;
        }
        buf_list = VQE_TAILQ_PREV(buf_list, 
                                  vqe_tsrap_app_tailq_head_, 
                                  list_entry);
    }
}
int main (int argc, char *argv[])
{
    char serverHost[NAME_SIZE];
    int  serverPort;
    int loglevel;

    if (argc < 5) {
        printf( "\nUsage: %s %s\n", argv[0], applicationUsage);
        exit(-1);
    }

    strncpy(serverHost, argv[1], NAME_SIZE);
    serverPort = atoi(argv[2]);
    loglevel = atoi(argv[3]);

    /* Initialize the logging facility */
    syslog_facility_open(LOG_RTSP, LOG_CONS);
    syslog_facility_filter_set(LOG_RTSP, LOG_INFO);

    /* Initialize a rtsp client */
    if (rtsp_client_init(serverHost, serverPort) != RTSP_SUCCESS) {
        printf("Error:: rtsp client initialization failed!\n");
        exit(-1);
    }

    char name[NAME_SIZE];
    strncpy(name, argv[4], NAME_SIZE);

    syslog_print(RTSP_CHANNEL_UPDATE_NOTICE);

    if (rtsp_send_request(
            name, MEDIA_TYPE_APP_SDP,
            TIME_ADD_A_R(get_sys_time(), VQEC_UPDATER_TIMEOUT_BACKGROUND))
        != RTSP_SUCCESS) {
        printf("Failed to send out the request!\n");
        exit(-1);
    }

    if (rtsp_get_response_code() == MSG_200_OK) {
        printf("\n\nResponse body = \n%s\n",
               rtsp_get_response_body());
    }

    if (rtsp_client_close() != RTSP_SUCCESS) {
        printf("Error:: rtsp client close failed!\n");
        exit(-1);
    }

    exit(0);
}
示例#10
0
/*
 * Function:    rtcp_get_local_source_ssrc
 * Description: Get the ssrc of the local source.
 *
 * @param[in] rtp_session Pointer to an rtp_session
 * @param[out] ssrc SSRC of the local source.
 * @param[out] boolean TRUE if we were able to get a local_source else FALSE.
 */
boolean rtp_get_local_source_ssrc (const rtp_session_t *rtp_session,
                                   uint32_t *ssrc)
{
    boolean rv=FALSE;
    
    if (rtp_session && rtp_session->rtp_local_source && ssrc) {
        *ssrc = rtp_session->rtp_local_source->ssrc;
        rv = TRUE;
    } else {
        if (ssrc) {
            *ssrc = 0;
        }
        syslog_print(VQEC_ERROR, "Unable to get local ssrc");
    }
    return rv;
}
示例#11
0
/* 
 *  ログ情報の出力
 *
 *  CPUロック状態や実行コンテキストによらず動作できるように実装してある.
 */
ER
syslog_wri_log(uint_t prio, const SYSLOG *p_syslog)
{
	SIL_PRE_LOC;

	LOG_SYSLOG_WRI_LOG_ENTER(prio, p_syslog);
	SIL_LOC_INT();

	/*
	 *  ログ時刻の設定
	 */
	((SYSLOG *) p_syslog)->logtim = _kernel_current_time;

	/*
	 *  ログバッファに記録
	 */
	if ((syslog_logmask & LOG_MASK(prio)) != 0U) {
		syslog_buffer[syslog_tail] = *p_syslog;
		syslog_tail++;
		if (syslog_tail >= TCNT_SYSLOG_BUFFER) {
			syslog_tail = 0U;
		}
		if (syslog_count < TCNT_SYSLOG_BUFFER) {
			syslog_count++;
		}
		else {
			syslog_head = syslog_tail;
			syslog_lost++;
		}
	}

	/*
	 *  低レベル出力
	 */
	if (((~syslog_lowmask_not) & LOG_MASK(prio)) != 0U) {
		syslog_print(p_syslog, target_fput_log);
		target_fput_log('\n');
	}

	SIL_UNL_INT();
	LOG_SYSLOG_WRI_LOG_LEAVE(E_OK);
	return(E_OK);
}
/*
 *  システムログの出力処理
 */
void
syslog_flush(void)
{
	SYSLOG	syslog;
	ER_UINT	rercd;

	/*
	 *  ログバッファに記録されたログ情報を,低レベル出力機能を用いて出
	 *  力する.
	 */
	while ((rercd = syslog_rea_log(&syslog)) >= 0) {
		if (rercd > 0) {
			syslog_lostmsg((uint_t) rercd, target_fput_log);
		}
		if (syslog.logtype >= LOG_TYPE_COMMENT) {
			syslog_print(&syslog, target_fput_log);
			target_fput_log('\n');
		}
	}
}
/**
 * Fills a list of buffers with TS packet data
 * 
 * @param buf_list      - Buffer list to receive data
 * @param pkt_data      - TS packets to be put into buf_list
 * @param pkt_cnt       - Number of packets in pkt_data
 * 
 * @return Number of bytes written into buf_list
 */
int mp_tlv_buf_fill (mp_tlv_buflist_t *buf_list, uint8_t *pkt_data, int pkt_cnt)
{
    int b_written=0;
    
    MP_TLV_ASSERT(buf_list, "mp_tlv_buf_fill: buf_list is NULL");
    while(pkt_cnt > 0){
        int buf_cnt = buf_list->buf_rem / MP_MPEG_TSPKT_LEN;
        int offset = buf_list->buf_len - buf_list->buf_rem;
        
        if(pkt_cnt<=buf_cnt){
            /* The current buffer can hold the entire contents 
               of the data. Place all of pkt_data into tspkt_buf
            */
            memcpy(&buf_list->tspkt_buf[offset], &pkt_data[b_written],
                    pkt_cnt * MP_MPEG_TSPKT_LEN);
            buf_list->buf_rem -= pkt_cnt * MP_MPEG_TSPKT_LEN;
            b_written += pkt_cnt * MP_MPEG_TSPKT_LEN;
            pkt_cnt=0;
        }
        else{
            /* The current buffer is too small for all the data. 
               Write as much as is possible to the current entry
               and then move on to the next one.
            */
            memcpy(&buf_list->tspkt_buf[offset], &pkt_data[b_written], 
                    buf_cnt * MP_MPEG_TSPKT_LEN);
            buf_list->buf_rem -= buf_cnt * MP_MPEG_TSPKT_LEN;
            b_written += buf_cnt * MP_MPEG_TSPKT_LEN;
            pkt_cnt-=buf_cnt;
            
            buf_list = VQE_TAILQ_NEXT(buf_list, list_entry);
            if(!buf_list && pkt_cnt > 0){
                syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                             "Buffer List is not large enough to store "
                             "all TS Packet Data.");
                pkt_cnt = 0;
            }
        }
    }
    return b_written;
}
示例#14
0
void
syslog_output(void (*putc)(char))
{
	SYSLOG	log;
	INT	lostnum, n;

	lostnum = 0;
	while ((n = vrea_log(&log)) >= 0) {
		lostnum += n;
		if (log.logtype < LOG_TYPE_COMMENT) {
			continue;
		}
		if (lostnum > 0) {
			syslog_lostmsg(lostnum, putc);
			lostnum = 0;
		}
		syslog_print(&log, putc);
	}
	if (lostnum > 0) {
		syslog_lostmsg(lostnum, putc);
	}
}
示例#15
0
文件: logtask.c 项目: inouema/toppers
/*
 *  システムログタスクの終了処理
 */
void
logtask_terminate(intptr_t exinf)
{
	char_t	c;
	SYSLOG	syslog;
	bool_t	msgflg = false;
	ER_UINT	rercd;
	ID my_logtask_portid = get_my_logtask_portid();

	/*
	 *  シリアルインタフェースドライバの送信バッファに蓄積されたデータ
	 *  を,低レベル出力機能を用いて出力する.
	 */
	while (serial_get_chr(my_logtask_portid, &c)) {
		target_fput_log(c);
	}

	/*
	 *  ログバッファに記録されたログ情報を,低レベル出力機能を用いて出
	 *  力する.
	 */
	while ((rercd = syslog_rea_log(&syslog)) >= 0) {
		if (!msgflg) {
			/*
			 *  ログバッファに残ったログ情報であることを示す文字列を出
			 *  力する.
			 */
			syslog_printf("-- buffered messages --\n", NULL, target_fput_log);
			msgflg = true;
		}
		if (rercd > 0) {
			syslog_lostmsg((uint_t) rercd, target_fput_log);
		}
		if (syslog.logtype >= LOG_TYPE_COMMENT) {
			syslog_print(&syslog, target_fput_log);
			target_fput_log('\n');
		}
	}
}
/*
 *  システムログタスクの終了処理(受け口関数)
 */
void
eLogTaskTerminate_main(intptr_t exinf)
{
	char	c;
	SYSLOG	syslog;
	bool_t	msgflg = false;
	ER_UINT	rercd;

	/*
	 *  シリアルインタフェースドライバの送信バッファに蓄積されたデータ
	 *  を,低レベル出力機能を用いて出力する.
	 */
	while (cnSerialPortManage_getChar(&c)) {
		target_fput_log(c);
	}

	/*
	 *  ログバッファに記録されたログ情報を,低レベル出力機能を用いて出
	 *  力する.
	 */
	while ((rercd = cSysLog_read(&syslog)) >= 0) {
		if (!msgflg) {
			/*
			 *  ログバッファに残ったログ情報であることを示す文字列を出
			 *  力する.
			 */
			syslog_printf("-- buffered messages --\n", NULL, target_fput_log);
			msgflg = true;
		}
		if (rercd > 0) {
			syslog_lostmsg((uint_t) rercd, target_fput_log);
		}
		if (syslog.logtype >= LOG_TYPE_COMMENT) {
			syslog_print(&syslog, target_fput_log);
			target_fput_log('\n');
		}
	}
}
/**
 * Decodes a Pidlist TLV into native Pidlist structure
 *
 *@param tlvdata_ptr            - Pointer to TLV Data
 *@param tlvdata_len            - Length of TLV Data
 *@param pidlist_ptr            - Pidlist to unpack data into
 *
 */
int mp_pidlisttlv_to_pidlist (const uint8_t *tlvdata_ptr, 
                              uint32_t tlvdata_len, 
                              mp_tlv_pidlist_t *pidlist_ptr)
{
    int status = MP_STATUS_TLV_SUCCESS;
    mp_tlv_pidlist_pac_t *pac_ptr = (mp_tlv_pidlist_pac_t*)tlvdata_ptr;
    mp_tlvhdr_pac_t *tlvhdr_ptr = &pac_ptr->tlvhdr; 
    mp_tlv_pidelement_pac_t *pide_ptr;
    uint16_t tlv_len = MP_GET_TLV_LEN(tlvhdr_ptr);
    int i, len=0; 
    char msgbuf[MP_TLV_MESSAGE_BUF_LEN];
    do { 
        for (i=0; ((i<MP_MAX_TSRAP_PIDS) && (len < tlv_len)); i++) {
            if (len%sizeof(mp_tlv_pidelement_pac_t) != 0) {
                status = MP_STATUS_TLV_PIDLIST_DECODE_FAILED;
                break; 
            }
            pide_ptr = &pac_ptr->dat[i];
            pidlist_ptr->dat[i].pid = MP_GET_PID(&pide_ptr->pid);
            pidlist_ptr->dat[i].cc = MP_GET_PID_ELEMENT_CC(pide_ptr);
            len+=sizeof(*pide_ptr);
        }
        pidlist_ptr->cnt = i; 
        if (i==MP_MAX_TSRAP_PIDS) {
            status = MP_STATUS_TLV_PIDLIST_DECODE_FAILED;
            break; 
        }
    } while (0);
    
    if (status != MP_STATUS_TLV_SUCCESS) {
        snprintf(msgbuf, MP_TLV_MESSAGE_BUF_LEN, 
                 "Error decoding TLV packets, status=%d", status);
        syslog_print(VQE_MP_TLV_ERR_PKTDEC, msgbuf);
    }

    return (status);

}
示例#18
0
int main(int argc, char *argv[])
{
	uint16_t reg_address = 0;
	uint8_t reg_val = 0;
	int c, ret=0;
	int option_index = 0;
	unsigned char cmd = 0;

	static struct option long_options[] = {
		{"version", no_argument, 0, 'v'},
		{"debug", no_argument, 0, 'd'},
		{"help", no_argument, 0, 'h'},
		{"file", required_argument, 0, 'i'},
		{NULL, 0, NULL, 0}
	};


	while ((c = getopt_long(argc, argv, "dh", long_options, &option_index)) != -1) {
		switch (c) {
		case 'd':
			syslog_trace = 1;
			break;
		case 'h':
			usage();
			break;
		default:
			printf("?? getopt returned character code 0%o ??\n", c);
		}
	}

	/* parse option non preceded by '-' */
	if ((optind < argc) && ((argc - optind) <= 3)) {
		syslog_print("non-option ARGV-elements: %s\n", argv[optind]);
		/* choose command type */
		if ((!strncmp("W", argv[optind], 1)) || (!strncmp("w", argv[optind], 1))) {
			cmd = WRITE;
			syslog_print("write\n");
		} else if ((!strncmp("R", argv[optind], 1)) || (!strncmp("r", argv[optind], 1))) {
			cmd = READ;
			syslog_print("read\n");
		} else {
			goto error_cmd;
		}

		syslog_print("asked command: %d\n", cmd);

		if ((optind + 1) > argc)
			goto error_cmd;

		optind++;

		/* extract adress */
		reg_address = strtoul(argv[optind], NULL, 0);

		/* extract value in case of write */
		if (cmd == WRITE) {
			/* next arg */
			if ((optind + 1) > argc)
				goto error_cmd;

			optind++;

			reg_val = strtoul(argv[optind], NULL, 0);
		}


	} else {
		goto error_cmd;
	}

	switch (cmd) {
		break;
	case READ:
		ret=abxxxx_read(reg_address, &reg_val);
		if(ret >=0 )
		{
			printf("READ: reg_address=0x%08x --> val = 0x%08x\n",
			reg_address, reg_val);
		}
		else
		{
			printf("READ: reg_address=0x%08x failed\n", reg_address);
			return ret;
		}
		break;
	case WRITE:
		ret = abxxxx_write(reg_address, reg_val);
		if(ret >= 0)
		{
			printf("WRITE: val = 0x%08x --> reg_address=0x%08x\n",
			reg_val, reg_address);
		}
		else
		{
			printf("WRITE: val = 0x%08x --> reg_address=0x%08x failed\n",
			reg_val, reg_address);
			return ret;
		}
		break;
	}

	return 0;
error_cmd:
	return -1;
}
int mp_tlv_to_tspkts (uint8_t *tlvdata_ptr, uint32_t tlvdata_len,
                      mp_tlv_mpegknobs_t *knobs_ptr,
                      uint32_t app_paks_per_rcc,
                      mp_tlv_decodecb_t *decodecb_ptr,
                      mp_tlv_buflist_t* buf_list,
                      void *callback_data,
                      mp_tlv_pidlist_t *pidlist)
{
    mp_tlv_status_t status = MP_STATUS_TLV_SUCCESS; 
    mp_tlvhdr_pac_t *tlvhdr_ptr;
    uint32_t tmp_cnt, len = 0;  
    uint32_t sect_len;
    uint16_t sect_pid;
    uint8_t *sectdata_ptr;
    uint16_t tlv_len; 
    int tlv_cnt=0, tspkt_cnt=0;
    uint32_t tspkt_bufcnt;
    uint32_t offset=0; 
    mp_tlvsect_pac_t *pac_sect_ptr;
    unsigned long long pcr_base = 0, pts_base = 0; 
    uint16_t pcr_ext, pts_ext;
    mp_tlvpcr_pac_t *pac_pcr_ptr, *pac_pts_ptr;
    mp_tsraptlv_types_t tlv_type = MP_TSRAP_TYPE_NONE;
    int pat_size=0;
    int b_written = 0;
    int i;
    int ts_pkts_stored; /* Num TS packets in buf_list so far */
    int ts_pkts_needed; /* Num TS packets we must now add    */
    int ts_pkts_avail;  /* Num TS pkts which can fit         */
    int left_over_ts_pkts;
    int num_nulls_needed;
    char msgbuf[MP_TLV_MESSAGE_BUF_LEN];

    /*
     * Buffer for decoding one TSRAP TLV into (up to
     * MP_MAX_TSPAKS_PER_TLV) TS Packets.
     */
    static uint8_t tspkt_buf[MP_MAX_TSPAKS_PER_TLV][MP_MPEG_TSPKT_LEN];

    tspkt_bufcnt = MP_MAX_TSPAKS_PER_TLV;

    memset(pidlist, 0, sizeof(*pidlist));
    memset(tspkt_buf, 0, (MP_MAX_TSPAKS_PER_TLV * MP_MPEG_TSPKT_LEN));
        
    tlvhdr_ptr = (mp_tlvhdr_pac_t *)tlvdata_ptr;
    for (; len < tlvdata_len;) {
        if ((tlvdata_len - len) < sizeof(*tlvhdr_ptr)) {
            status = MP_STATUS_TLV_INVALID_LEN;
            break; 
        }
        tlv_type = (mp_tsraptlv_types_t)MP_GET_TLV_TYPE(tlvhdr_ptr);
        tlv_len =  MP_GET_TLV_LEN(tlvhdr_ptr);
        switch (tlv_type) { 
        case MP_TSRAP_TYPE:
            /*************************************************************
             * The MP_TSRAP_TYPE is a special case because it marks the
             * beginning of the TLV data set. The len and value correspond 
             * to all the rest of the tlv data that is in the set. 
             * If  present it must be the first. 
             *************************************************************/
            if (tlv_cnt++ != 0) {
                status = MP_STATUS_TLV_SHOULD_BE_FIRST;
                break;
            }
            len += MP_TLV_HDR_LEN;
            tlvhdr_ptr += 1;
            continue;
        case MP_TSRAP_PA_TYPE:
        case MP_TSRAP_PMAP_TYPE:
        case MP_TSRAP_SEQPEXT_TYPE:
        case MP_TSRAP_SPS_TYPE:
        case MP_TSRAP_PPS_TYPE:
        case MP_TSRAP_SEI_TYPE:
        case MP_TSRAP_ECM_TYPE:
        case MP_TSRAP_ECM_PES_TYPE:
            /*************************************************************
             * Process a section TLV containing raw data. This could be
             * PAT, PMT, or Sequence/SEI data
             * Create 188B Mpeg pkt(s) that carry the data
             * Return number of TS pkts created. 
             *************************************************************/
            pac_sect_ptr = (mp_tlvsect_pac_t*)tlvhdr_ptr;
            sect_len = MP_GET_SECTTLV_LEN(pac_sect_ptr);
            sect_pid = MP_GET_SECTTLV_PID(pac_sect_ptr);
            sectdata_ptr = (uint8_t*)(pac_sect_ptr+1);
            tmp_cnt = mp_secttlv_to_tspkts 
                ((uint8_t*)tlvhdr_ptr,
                 tlv_len + MP_TLV_HDR_LEN, 
                 tspkt_buf,
                 tspkt_bufcnt, 
                 (tlv_type == MP_TSRAP_ECM_PES_TYPE),
                 ((tlv_type == MP_TSRAP_SEQPEXT_TYPE) ||
                  (tlv_type == MP_TSRAP_SPS_TYPE) ||
                  (tlv_type == MP_TSRAP_PPS_TYPE)));

            if (tmp_cnt == 0){
                status = MP_STATUS_TLV_DECODE_FAILED;
                break; 
            }
            b_written = mp_tlv_buf_fill(buf_list, (uint8_t *)&tspkt_buf, 
                                        tmp_cnt);  
            if (b_written != tmp_cnt * MP_MPEG_TSPKT_LEN) {
                syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                             "MP - Couldn't write all packets to buf");
                status = MP_STATUS_BUFF_TOO_SMALL;
                break;
            }

            tspkt_cnt += tmp_cnt; 

            mp_run_tlv_callback(decodecb_ptr, tlv_type, sectdata_ptr,
                                sect_len, sect_pid, callback_data);

            /* Now we deal with the PAT & PMT individually. If we just
             * processed the PAT, allocate a buffer for it and save it away
             * so it can be used in duplicating the PAT & PMT.
             */
            if (knobs_ptr->num_patpmt > 1) { 
                if(tlv_type == MP_TSRAP_PA_TYPE){
                    pat_size = tmp_cnt;
                    memcpy(s_pat_buf, &tspkt_buf, tmp_cnt * MP_MPEG_TSPKT_LEN);
                }
                else if(tlv_type == MP_TSRAP_PMAP_TYPE){
                    int i = 0;
                    for(i = 0; i < (knobs_ptr->num_patpmt -1); i++){
                        b_written = mp_tlv_buf_fill(buf_list, 
                                                    s_pat_buf, 
                                                    pat_size);
                        if (b_written != pat_size * MP_MPEG_TSPKT_LEN) {
                            syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                                         "MP - Couldn't write all "
                                         "packets to buf");
                            status = MP_STATUS_BUFF_TOO_SMALL;
                            break;
                        }
                        tspkt_cnt += pat_size;

                        b_written = mp_tlv_buf_fill(buf_list, 
                                                    (uint8_t*)&tspkt_buf,
                                                    tmp_cnt);
                        if (b_written != tmp_cnt * MP_MPEG_TSPKT_LEN) {
                            syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                                         "MP - Couldn't write all "
                                         "packets to buf");
                            status = MP_STATUS_BUFF_TOO_SMALL;
                            break;
                        }
                        tspkt_cnt += tmp_cnt;
                    }
                }
            }
            break;
        case MP_TSRAP_PCR_TYPE:
            pac_pcr_ptr = (mp_tlvpcr_pac_t*)tlvhdr_ptr;
            pcr_base = MP_GET_PCR_BASE(pac_pcr_ptr);
            pcr_ext = MP_GET_PCR_EXT(pac_pcr_ptr);
            if (decodecb_ptr && decodecb_ptr->pcr_cb) {
                decodecb_ptr->pcr_cb(pcr_base, pcr_ext, callback_data);
            }
 
            offset = 1; 
            tmp_cnt = mp_pcrtlv_to_tspkts ((uint8_t*)tlvhdr_ptr,
                                           tlv_len+MP_TLV_HDR_LEN,
                                           &knobs_ptr->pcr_knobs, offset, 
                                           tspkt_buf, tspkt_bufcnt);
            if ( tmp_cnt == 0 ){
                status = MP_STATUS_TLV_PCR_DECODE_FAILED ;
                break; 
            }
            
            b_written = mp_tlv_buf_fill(buf_list, 
                                        (uint8_t *)&tspkt_buf, 
                                        tmp_cnt);
            if (b_written != tmp_cnt * MP_MPEG_TSPKT_LEN) {
                syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                             "MP - Couldn't write all packets to buf");
                status = MP_STATUS_BUFF_TOO_SMALL;
                break;
            }
            tspkt_cnt += tmp_cnt; 

            break;

        case MP_TSRAP_PTS_TYPE:
            pac_pts_ptr = (mp_tlvpcr_pac_t*)tlvhdr_ptr;
            pts_base = MP_GET_PCR_BASE(pac_pts_ptr);
            pts_ext = MP_GET_PCR_EXT(pac_pts_ptr);
            if (decodecb_ptr && decodecb_ptr->pts_cb) {
                decodecb_ptr->pts_cb(pts_base, callback_data);
            }
            break;

        case MP_TSRAP_PIDLIST_TYPE:
            status = mp_pidlisttlv_to_pidlist ((uint8_t*)tlvhdr_ptr,
                                               tlv_len+MP_TLV_HDR_LEN, 
                                               pidlist);
            break;
        case MP_TSRAP_CA_TYPE:
        default:
            /* ignore */
            break;
        }

        if (status != MP_STATUS_TLV_SUCCESS) {
            break; 
        }
        tlv_cnt++;
        len += (tlv_len + MP_TLV_HDR_LEN);
        tlvhdr_ptr = (mp_tlvhdr_pac_t*)(tlvdata_ptr + len);
    }
    if (status == MP_STATUS_TLV_SUCCESS) {

        /* If the buffer contains a number of TS packets which are not a 
         * multiple of MP_NUM_TSPAKS_PER_DP_PAK, add MPEG nulls to make
         * it such a multiple.
         */
        left_over_ts_pkts = tspkt_cnt % MP_NUM_TSPAKS_PER_DP_PAK;

        if (left_over_ts_pkts != 0) {

            num_nulls_needed = MP_NUM_TSPAKS_PER_DP_PAK - left_over_ts_pkts;
            if (mp_tlv_buf_pad(buf_list, num_nulls_needed) 
                != MP_STATUS_TLV_SUCCESS) {
              
                syslog_print(VQE_MP_TLV_ERR_OUTBUF_PAD,
                             "MP - Padding output packet buffer failed");
                goto failed;
            }
            tspkt_cnt += num_nulls_needed;
        }

        if (app_paks_per_rcc > 1) {

            /* 
             * Note: we assume at most one buffer in buf_list - current 
             * limitation, and should replace buf_list with a single global
             * buffer in future
             */
            ts_pkts_stored = (buf_list->buf_len - buf_list->buf_rem) 
                / MP_MPEG_TSPKT_LEN;
            ts_pkts_needed = ts_pkts_stored * (app_paks_per_rcc - 1);
            ts_pkts_avail  = buf_list->buf_rem / MP_MPEG_TSPKT_LEN;

            if (ts_pkts_needed > ts_pkts_avail) {
                syslog_print(VQE_MP_TLV_ERR_BUF_TOO_SMALL, 
                             "MP - Couldn't write all packets to buf");
                status = MP_STATUS_BUFF_TOO_SMALL;
                goto failed;
            }

            for (i=0; i < (app_paks_per_rcc - 1); i++) {
                memcpy(&buf_list->tspkt_buf
                       [buf_list->buf_len - buf_list->buf_rem],
                       &buf_list->tspkt_buf[0],
                       ts_pkts_stored * MP_MPEG_TSPKT_LEN);
                buf_list->buf_rem -= (ts_pkts_stored * MP_MPEG_TSPKT_LEN);
                tspkt_cnt += ts_pkts_stored;
            }
        }

        /* Now loop through packets that are being prepended to the front
         * of the burst in REVERSE order to make the cc work out.
         */

        mp_correct_tspkt_cc(pidlist, buf_list, tspkt_cnt);
        snprintf(msgbuf, MP_TLV_MESSAGE_BUF_LEN, 
                 "MP - Decoded TSRAP TLV data, tlv proc=%d, "
                 "TS pkts generated=%d", tlv_cnt, tspkt_cnt);
        syslog_print(VQE_MP_TLV_INFO, msgbuf);
    } else {
failed:
        snprintf(msgbuf, MP_TLV_MESSAGE_BUF_LEN, 
                 "MP - Error decoding TLV pkts type=%d, "
                 "status=%d", tlv_type, status);
        syslog_print(VQE_MP_TLV_ERR_PKT_DEC_TYPE, msgbuf);
        tspkt_cnt = 0; /* tell caller we failed */
    }

    return (tspkt_cnt * MP_MPEG_TSPKT_LEN);
}
/**---------------------------------------------------------------------------
 *  Open the kernel module device and map the shared memory pages
 *  for requests and responses.
 *
 * @param[out] vqec_error_t Returns VQEC_OK on success, VQEC_ERR_INTERANL
 * on failure.
 *---------------------------------------------------------------------------*/
static vqec_error_t
vqec_rpc_client_open_dev (void)
{
#define VQEC_RPCLIENT_LOGBUF_LEN 80
    char mbuf[VQEC_RPCLIENT_LOGBUF_LEN];
    vqec_error_t err = VQEC_ERR_INTERNAL;

    s_vqec_dp_kmod_devid =
        open(VQEC_KERNEL_DEVNODE_PATH "vqec0", O_RDWR);
    if (s_vqec_dp_kmod_devid == -1) {
        snprintf(mbuf, VQEC_RPCLIENT_LOGBUF_LEN,
                 "device open %s failed (%d)",
                 VQEC_KERNEL_DEVNODE_PATH "vqec0", errno);
        syslog_print(VQEC_ERROR, mbuf);
        goto done;
    }

    s_vqec_shm_reqbuf_ptr = mmap(0,
                                 VQEC_DEV_IPC_BUF_LEN,
                                 PROT_WRITE,
                                 MAP_SHARED,
                                 s_vqec_dp_kmod_devid,
                                 VQEC_DEV_IPC_BUF_REQ_OFFSET);
    if (s_vqec_shm_reqbuf_ptr == (void *)-1) {
        snprintf(mbuf, VQEC_RPCLIENT_LOGBUF_LEN,
                 "mmap failed for request offset (%d)", errno);
        syslog_print(VQEC_ERROR, mbuf);
        goto done;
    }

    /*
     * SH4 cores if an attempt is made to cache-invalidate a page which is
     * mapped as read-only. Hence the response buffer is also mapped as R/W.
     */
    s_vqec_shm_rspbuf_ptr = mmap(0,
                                 VQEC_DEV_IPC_BUF_LEN,
                                 PROT_WRITE,
                                 MAP_SHARED,
                                 s_vqec_dp_kmod_devid,
                                 VQEC_DEV_IPC_BUF_RSP_OFFSET);
    if (s_vqec_shm_rspbuf_ptr == (void *)-1) {
        snprintf(mbuf, VQEC_RPCLIENT_LOGBUF_LEN,
                 "mmap failed for response offset (%d)", errno);
        syslog_print(VQEC_ERROR, mbuf);
        goto done;
    }

    /*
     * Write to all pages which will cause them to be mapped via the
     * nopage method; not having a write prior to an initial read causes
     * SH4 to core.
     */
    memset(s_vqec_shm_reqbuf_ptr, 0, VQEC_DEV_IPC_BUF_LEN);
    memset(s_vqec_shm_rspbuf_ptr, 0, VQEC_DEV_IPC_BUF_LEN);
    err = VQEC_OK;

done:
    if (err != VQEC_OK) {
        if (s_vqec_dp_kmod_devid != -1) {
            close(s_vqec_dp_kmod_devid);
        }
    }
    return (err);
}
示例#21
0
/**---------------------------------------------------------------------------
 * Front-end RTCP event handler.
 *
 * @param[in] rtp_session Pointer to a repair or primary session.
 * @param[in] rtcp_sock Input socket to be read.
 * @param[in] iobuf An IO buffer to receive RTCP packet data.
 * @param[in] iobuf_len Length of the IO buffer.
 * @param[in] is_primary_session True if the session is the primary session.
 *---------------------------------------------------------------------------*/ 
void
rtcp_event_handler_internal (rtp_session_t *rtp_session,
                             vqec_recv_sock_t *rtcp_sock,
                             char *iobuf,
                             uint32_t iobuf_len,
                             boolean is_primary_session)
{
    int32_t pak_buff_len;
    struct in_addr pak_src_addr;
    uint16_t pak_src_port;
    struct timeval recv_time;    

    VQEC_ASSERT(rtp_session && rtcp_sock && iobuf && iobuf_len);

    while (TRUE) {
        pak_buff_len = vqec_recv_sock_read(rtcp_sock, 
                                           &recv_time, 
                                           iobuf,
                                           iobuf_len,
                                           &pak_src_addr, 
                                           &pak_src_port);
        if (pak_buff_len < 1) {
            break;
        } else { 
            if ((iobuf[0] & 0xC0) == 0) {
                /* NAT packet */
                if (!is_primary_session) {
                    /* send to the NAT protocol for repair session. */
                    if(!vqec_chan_eject_rtcp_nat_pak(
                           rtp_repair_session_chanid(
                               (rtp_repair_recv_t *)rtp_session),
                           iobuf, 
                           pak_buff_len, 
                           VQEC_CHAN_RTP_SESSION_REPAIR,
                           pak_src_addr.s_addr,
                           pak_src_port)) {
                        syslog_print(VQEC_ERROR, 
                                     "Eject of NAT packet failed repair");
                    }
                } else {
                    /* send to the NAT protocol for primary session. */                 
                    if(!vqec_chan_eject_rtcp_nat_pak(
                           rtp_era_session_chanid(
                               (rtp_era_recv_t *)rtp_session),
                           iobuf, 
                           pak_buff_len, 
                           VQEC_CHAN_RTP_SESSION_PRIMARY,
                           pak_src_addr.s_addr,
                           pak_src_port)) {
                        syslog_print(VQEC_ERROR, 
                                     "Eject of NAT packet failed primary");
                    }
                }
                continue;
            }
            
            rtcp_event_handler_internal_process_pak(rtp_session, 
                                                    pak_src_addr,
                                                    pak_src_port,
                                                    iobuf,
                                                    pak_buff_len,
                                                    &recv_time);
        }
    }

    return;
}
示例#22
0
char *
RaDumpUserBuffer (struct ArgusParserStruct *parser, struct ArgusRecordStruct *argus, int ind, int len) 
{
   struct ArgusFlow *flow = (struct ArgusFlow *) argus->dsrs[ARGUS_FLOW_INDEX];
   unsigned short sport = 0, dport = 0;
   int type, proto, process = 0;
   struct ArgusDataStruct *user = NULL;
   u_char buf[MAXSTRLEN], *bp = NULL, dchr;
   int slen = 0, done = 0;

   switch (ind) {
      case ARGUS_SRCUSERDATA_INDEX:
         dchr = 's';
         break;
      case ARGUS_DSTUSERDATA_INDEX:
         dchr = 'd';
         break;
   }

   if ((user = (struct ArgusDataStruct *)argus->dsrs[ind]) != NULL) {
      bp = (u_char *) &user->array;
      slen = (user->hdr.argus_dsrvl16.len - 2 ) * 4;
      slen = (user->count < slen) ? user->count : slen;
      slen = (slen > len) ? len : slen;
      snapend = bp + slen;
   }

   if (flow != NULL) {
      switch (flow->hdr.subtype & 0x3F) {
         case ARGUS_FLOW_CLASSIC5TUPLE: {
            switch (type = flow->hdr.argus_dsrvl8.qual) {
               case ARGUS_TYPE_IPV4:
                  switch (flow->ip_flow.ip_p) {
                     case IPPROTO_TCP:
                     case IPPROTO_UDP: {
                        proto = flow->ip_flow.ip_p;
                        sport = flow->ip_flow.sport;
                        dport = flow->ip_flow.dport;
                        process++;
                        break;
                     }
                     case IPPROTO_IGMP: {
                        struct ArgusMetricStruct *metric = (void *)argus->dsrs[ARGUS_METRIC_INDEX];
                        if ((metric != NULL) && (((ind == ARGUS_SRCUSERDATA_INDEX) && metric->src.pkts) ||
                                                 ((ind == ARGUS_DSTUSERDATA_INDEX) && metric->dst.pkts))) {
                           igmp_print(bp, slen);
                           done++;
                           break;
                        }
                     }

                     case IPPROTO_PIM: {
                        struct ArgusMetricStruct *metric = (void *)argus->dsrs[ARGUS_METRIC_INDEX];
                        if ((metric != NULL) && (((ind == ARGUS_SRCUSERDATA_INDEX) && metric->src.pkts) ||
                                                 ((ind == ARGUS_DSTUSERDATA_INDEX) && metric->dst.pkts))) {
                           pim_print(bp, slen);
                           done++;
                           break;
                        }
                     }
                  }
                  break; 
               case ARGUS_TYPE_IPV6: {
                  switch (flow->ipv6_flow.ip_p) {
                     case IPPROTO_TCP:
                     case IPPROTO_UDP: {
                        proto = flow->ipv6_flow.ip_p;
                        sport = flow->ipv6_flow.sport;
                        dport = flow->ipv6_flow.dport;
                        process++;
                        break;
                     }

                     case IPPROTO_PIM: {
                        struct ArgusMetricStruct *metric = (void *)argus->dsrs[ARGUS_METRIC_INDEX];

                        if ((metric != NULL) && (((ind == ARGUS_SRCUSERDATA_INDEX) && metric->src.pkts) ||
                                                 ((ind == ARGUS_DSTUSERDATA_INDEX) && metric->dst.pkts))) {
                           pim_print(bp, slen);
                           done++;
                           break;
                        }
                     }
                  }
                  break;
               }
               case ARGUS_TYPE_ARP: {
                  if (ind == ARGUS_SRCUSERDATA_INDEX) {
                     arp_src_print(parser, argus);
                  }
                  if (ind == ARGUS_DSTUSERDATA_INDEX) {
                     arp_dst_print(parser, argus);
                  }
                  done++;
                  break;
               }
/*
struct ArgusMacFlow {
   struct ether_header ehdr;
   unsigned char dsap, ssap;
};

*/

               case ARGUS_TYPE_ETHER: {
                  if (flow != NULL)
                     if ((flow->mac_flow.mac_union.ether.ssap == LLCSAP_BPDU) &&
                         (flow->mac_flow.mac_union.ether.dsap == LLCSAP_BPDU))
                        stp_print (bp, slen);
                  done++;
                  break;
               }
            }
         }
      }
   }

   if (process && bp) {
      *(int *)&buf = 0;

#define ISPORT(p) (dport == (p) || sport == (p))

      switch (proto) {
         case IPPROTO_TCP: {
            if (ISPORT(BGP_PORT))
               bgp_print(bp, slen); 
            else if (ISPORT(TELNET_PORT))
               telnet_print(bp, slen);
            else if (ISPORT(PPTP_PORT))
               pptp_print(bp, slen);
            else if (ISPORT(NETBIOS_SSN_PORT))
               nbt_tcp_print(bp, slen);
            else if (ISPORT(BEEP_PORT))
               beep_print(bp, slen);
            else if (ISPORT(NAMESERVER_PORT) || ISPORT(MULTICASTDNS_PORT)) 
                ns_print(bp + 2, slen - 2, 0);
            else if (ISPORT(MSDP_PORT))
               msdp_print(bp, slen);
            else if (ISPORT(LDP_PORT))
               ldp_print(bp, slen);
            else {
               int elen = 0;
               parser->eflag = ArgusThisEflag;
               elen = ArgusEncode (parser, (const char *)bp, NULL, slen, ArgusBuf, sizeof(ArgusBuf));
               parser->eflag = ARGUS_HEXDUMP;
            }
            break;
         }

         case IPPROTO_UDP: {
            if (ISPORT(NAMESERVER_PORT))
               ns_print(bp, slen, 0);
            else if (ISPORT(MULTICASTDNS_PORT))
               ns_print(bp, slen, 1);
            else if (ISPORT(NTP_PORT))
               ntp_print(bp, slen);
            else if (ISPORT(LDP_PORT))
               ldp_print(bp, slen);
            else if (ISPORT(RADIUS_PORT) || ISPORT(RADIUS_NEW_PORT) ||
                     ISPORT(RADIUS_ACCOUNTING_PORT) ||
                     ISPORT(RADIUS_NEW_ACCOUNTING_PORT) )
               radius_print(bp, slen);
            else if (ISPORT(KERBEROS_PORT) || ISPORT(KERBEROS_SEC_PORT))
               krb_print(bp, slen);
            else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT))
               snmp_print(bp, slen);
            else if (ISPORT(TIMED_PORT))
               timed_print(bp, slen);
            else if (ISPORT(TFTP_PORT))
               tftp_print(bp, slen);
            else if (ISPORT(IPPORT_BOOTPC) || ISPORT(IPPORT_BOOTPS))
               bootp_print(bp, slen);
            else if (ISPORT(RIP_PORT))
               rip_print(bp, slen);
            else if (ISPORT(AODV_PORT))
               aodv_print(bp, slen, 0);
            else if (ISPORT(L2TP_PORT))
               l2tp_print(bp, slen);
            else if (ISPORT(SYSLOG_PORT))
               syslog_print(bp, slen);
            else if (ISPORT(LMP_PORT))
               lmp_print(bp, slen);
            else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
                     (dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
               rx_print(bp, slen, sport, dport);
            else if (dport == BFD_CONTROL_PORT || dport == BFD_ECHO_PORT )
               bfd_print(bp, slen, dport);
            else if (ISPORT(NETBIOS_NS_PORT))
               nbt_udp137_print(bp, slen);
            else if (ISPORT(NETBIOS_DGRAM_PORT))
               nbt_udp138_print(bp, slen);
            else if (ISPORT(ISAKMP_PORT))
               isakmp_print(bp, slen);
            else if (ISPORT(ISAKMP_PORT_NATT))
               isakmp_rfc3948_print(bp, slen);
            else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2))
               isakmp_print(bp, slen);
            else {
               int elen = 0;
               parser->eflag = ArgusThisEflag;
               elen = ArgusEncode (parser, (const char *)bp, NULL, slen, ArgusBuf, sizeof(ArgusBuf));
               parser->eflag = ARGUS_HEXDUMP;
            }
/*
            else if (ISPORT(3456))
               vat_print(bp, slen);
            else if (ISPORT(ZEPHYR_SRV_PORT) || ISPORT(ZEPHYR_CLT_PORT))
               zephyr_print(bp, slen);
            else if (ISPORT(RIPNG_PORT))
               ripng_print(bp, slen);
            else if (ISPORT(DHCP6_SERV_PORT) || ISPORT(DHCP6_CLI_PORT))
               dhcp6_print(bp, slen);
            else if (dport == 4567)
               wb_print(bp, slen);
            else if (ISPORT(CISCO_AUTORP_PORT))
               cisco_autorp_print(bp, slen);
            else if (ISPORT(RADIUS_PORT) || ISPORT(RADIUS_NEW_PORT) ||
                     ISPORT(RADIUS_ACCOUNTING_PORT) || ISPORT(RADIUS_NEW_ACCOUNTING_PORT) )
               radius_print(bp, slen);
            else if (dport == HSRP_PORT)
               hsrp_print(bp, slen);
            else if (ISPORT(LWRES_PORT))
               lwres_print(bp, slen);
            else if (ISPORT(MPLS_LSP_PING_PORT))
               lspping_print(bp, slen);
*/
         }
      }
   }

   return (ArgusBuf);
}