Example #1
0
/*
 * Print an ATMARP interface entry
 *
 * Arguments:
 *	df	pointer to a FILE for the dump
 *	aip	pointer to interface entry
 *
 * Returns:
 *	None
 *
 */
void
print_atmarp_intf(FILE *df, Atmarp_intf *aip)
{
	if (!aip) {
		fprintf(df, "print_atmarp_intf: NULL interface entry address\n");
		return;
	}

	fprintf(df, "ATMARP network interface entry at %p\n", aip);
	fprintf(df, "\tai_next:           %p\n", aip->ai_next);
	fprintf(df, "\tai_intf:           %s\n", aip->ai_intf);
	fprintf(df, "\tai_ip_addr:        %s\n",
			format_ip_addr(&aip->ai_ip_addr));
	fprintf(df, "\tai_subnet_mask:    %s\n",
			inet_ntoa(aip->ai_subnet_mask));
	fprintf(df, "\tai_mtu:            %d\n", aip->ai_mtu);
	fprintf(df, "\tai_atm_addr:       %s\n",
			format_atm_addr(&aip->ai_atm_addr));
	fprintf(df, "\tai_atm_subaddr:    %s\n",
			format_atm_addr(&aip->ai_atm_subaddr));
	fprintf(df, "\tai_scsp_sock:      %d\n", aip->ai_scsp_sock);
	fprintf(df, "\tai_scsp_sockname:  %s\n", aip->ai_scsp_sockname);
	fprintf(df, "\tai_state:          %d\n", aip->ai_state);
	fprintf(df, "\tai_mark:           %d\n", aip->ai_mark);
}
Example #2
0
/*
 * Print network interface information
 * 
 * Arguments:
 *	ni	pointer to a struct air_int_rsp
 *
 * Returns:
 *	none
 *
 */
void
print_netif_info(struct air_netif_rsp *ni)
{
	const char		*ip_addr;
	struct sockaddr_in	*sin;

	/*
	 * Print a header
	 */
	if (!netif_hdr) {
		netif_hdr++;
		printf(NETIF_HDR);
	}

	/*
	 * Format the protocol address
	 */
	sin = (struct sockaddr_in *)&ni->anp_proto_addr;
	ip_addr = format_ip_addr(&sin->sin_addr);

	/*
	 * Print the network interface information
	 */
	printf("%-8s  %-8s  %s\n",
			ni->anp_intf,
			ni->anp_phy_intf,
			ip_addr);
}
Example #3
0
string callex::to_str()
{
	ostringstream oss;
	oss << "call id        :" << call_.call_id << endl
		<< "call trans id  :" << call_.call_trans_id << endl
		<< "call_type      :" << ACDServer::to_str(call_.call_type) << endl
		<< "call direction :" << ACDServer::to_str(call_.call_direction) << endl
		<< "calling        :" << call_.calling_device << endl
		<< "called         :" << call_.called_device << endl
		<< "connections:" << endl;

	oss << std::left;
	for (auto it = call_.connections.begin(); it != call_.connections.end(); it++)
	{
		oss << "    conn:";
		oss.width(25);
		oss << it->device.device_id;
		oss.width(15);
		oss << ", " << it->device.line_no;
		oss.width(15);
		oss << ", " << ACDServer::to_str(it->device.device_type);
		oss.width(15);
		oss << ", " << format_ip_addr(it->device.ip);
		oss.width(15);
		oss << ", " << ntohs(it->device.port) << endl;
	}

	return oss.str();
}
Example #4
0
void L3Socket::add_ip_addr(unsigned char* ip_str,unsigned char* netmask){
	BOOST_LOG_TRIVIAL(debug) << ifname <<" Start Working ARP";
	ARPProtocolHandler* arp_hdl = ARPProtocolHandler::getInstance();
	add_protocol(arp_hdl);
	in_addr ip;
	inet_aton((const char* )ip_str,&ip);
	IPProtocolHandler* ip_hdl = IPProtocolHandler::getInstance();
	in_addr netmask_addr;
	inet_aton((const char* )netmask,&netmask_addr);
	ip_hdl->add_ip_addr(ip.s_addr,netmask_addr.s_addr,this);
	add_protocol(ip_hdl);
	BOOST_LOG_TRIVIAL(debug) << ifname <<" Start Working IP";
	BOOST_LOG_TRIVIAL(debug) << "Setting IP Addr " << format_ip_addr((uint8_t*)(&ip.s_addr)) << " Iface "<< ifname;
}
Example #5
0
/*
 * Print IP address map information
 * 
 * Arguments:
 *	ai	pointer to a struct air_arp_rsp
 *
 * Returns:
 *	none
 *
 */
void
print_ip_vcc_info(struct air_ip_vcc_rsp *ai)
{
	int	i;
	const char	*ip_addr, *state;
	char	flags[32], vpi_vci[16];
	struct sockaddr_in	*sin;

	/*
	 * Print a header if it hasn't been done yet.
	 */
	if (!ip_vcc_hdr) {
		printf(IP_VCC_HDR);
		ip_vcc_hdr = 1;
	}

	/*
	 * Format the IP address
	 */
	sin = (struct sockaddr_in *)&ai->aip_dst_addr;
	ip_addr = format_ip_addr(&sin->sin_addr);

	/*
	 * Format the VPI/VCI
	 */
	if (ai->aip_vpi == 0 && ai->aip_vci == 0) {
		strcpy(vpi_vci, "  -     -");
	} else {
		sprintf(vpi_vci, "%3d %5d", ai->aip_vpi, ai->aip_vci);
	}

	/*
	 * Decode VCC flags
	 */
	UM_ZERO(flags, sizeof(flags));
	if (ai->aip_flags & IVF_PVC) {
		strcat(flags, "P");
	}
	if (ai->aip_flags & IVF_SVC) {
		strcat(flags, "S");
	}
	if (ai->aip_flags & IVF_LLC) {
		strcat(flags, "L");
	}
	if (ai->aip_flags & IVF_MAPOK) {
		strcat(flags, "M");
	}
	if (ai->aip_flags & IVF_NOIDLE) {
		strcat(flags, "N");
	}

	/*
	 * Get the state of the VCC
	 */
	for (i=0; ip_vcc_states[i].s_name != NULL && 
			ai->aip_state != ip_vcc_states[i].s_id;
			i++);
	if (ip_vcc_states[i].s_name) {
		state = ip_vcc_states[i].s_name;
	} else {
		state = "-";
	}

	/*
	 * Print the IP VCC information
	 */
	printf("%-8s  %9s  %-7s %-5s %s\n",
			ai->aip_intf,
			vpi_vci,
			state,
			flags,
			ip_addr);
}
Example #6
0
/*
 * Print ARP table information
 * 
 * Arguments:
 *	ai	pointer to a struct air_arp_rsp
 *
 * Returns:
 *	none
 *
 */
void
print_arp_info(struct air_arp_rsp *ai)
{
	int	i;
	const char	*atm_addr, *ip_addr, *origin;
	char	age[8], flags[32];
	struct sockaddr_in	*sin;

	/*
	 * Print a header if it hasn't been done yet.
	 */
	if (!arp_hdr) {
		printf(ARP_HDR);
		arp_hdr = 1;
	}

	/*
	 * Format the addresses
	 */
	atm_addr = format_atm_addr(&ai->aap_addr);
	sin = (struct sockaddr_in *)&ai->aap_arp_addr;
	ip_addr = format_ip_addr(&sin->sin_addr);

	/*
	 * Decode the flags
	 */
	UM_ZERO(flags, sizeof(flags));
	if (ai->aap_flags & ARPF_VALID) {
		strcat(flags, "V");
	}
	if (ai->aap_flags & ARPF_REFRESH) {
		strcat(flags, "R");
	}

	/*
	 * Format the origin
	 */
	for (i=0; arp_origins[i].s_name != NULL && 
			ai->aap_origin != arp_origins[i].s_id;
			i++);
	if (arp_origins[i].s_name) {
		origin = arp_origins[i].s_name;
	} else {
		origin = "-";
	}

	/*
	 * Format the age
	 */
	UM_ZERO(age, sizeof(age));
	if (!(ai->aap_flags & ARPF_VALID)) {
		strcpy(age, "-");
	} else {
		sprintf(age, "%d", ai->aap_age);
	}

	/*
	 * Print the ARP information
	 */
	printf("%-8s  %-5s  %3s  %s\n    ATM address = %s\n    IP address = %s\n",
			ai->aap_intf,
			flags,
			age,
			origin,
			atm_addr,
			ip_addr);
}