void sndmsg(struct sockaddr *dst, int flags, struct interface *ifp, int rtstate) { (void)rtstate; (*afswitch[dst->sa_family].af_output)(sock, flags, dst, sizeof (struct rip)); TRACE_OUTPUT(ifp, dst, sizeof (struct rip)); }
/* * Output a preformed packet. */ void sndmsg(struct sockaddr *dst, int flags, struct interface *ifp, int changesonly) { (*afswitch[dst->sa_family].af_output) (ripsock, flags, dst, sizeof (struct rip)); TRACE_OUTPUT(ifp, dst, sizeof (struct rip)); }
/*ARGSUSED*/ void sendpacket(struct sockaddr_in6 *sin6, struct interface *ifp, int size, int flags) { if (sendto(ifp->int_sock, packet, size, flags, (struct sockaddr *)sin6, sizeof (*sin6)) < 0) { syslog(LOG_ERR, "sendpacket: sendto: %m"); return; } TRACE_OUTPUT(ifp, sin6, sizeof (struct rip6)); ifp->int_opackets++; }
MStatus uninitializePlugin( MObject obj) { TRACE_OUTPUT("uninitializePlugin(...)") MStatus status; MFnPlugin plugin( obj ); status = plugin.deregisterNode( audioAnalyzer::id ); if (!status) { status.perror("deregisterNode"); return status; } return status; }
MStatus initializePlugin( MObject obj ) { TRACE_OUTPUT("initializePlugin(...)") MStatus status; MFnPlugin plugin( obj, "Tim Milstead", "1.0", "Any"); status = plugin.registerNode( "audioAnalyzer", audioAnalyzer::id, audioAnalyzer::creator, audioAnalyzer::initialize ); if (!status) { status.perror("Error registering audioData node"); return status; } return status; }
void sndmsg(struct sockaddr *dst, int flags, struct interface *ifp, int rtstate) { //WiSOC add send mode check for different network interface struct cfg_interface *ifcp; struct rip *query = msg; ifcp = (struct cfg_interface *)if_cfg_lookup(ifp->int_name); (void)rtstate; //printf("ifname=%s, rip_ver=%d, ifcp->send_mode=%d\n", ifcp->if_name, query->rip_vers, ifcp->send_mode); if (ifcp->send_mode == RIP_V2 || ifcp->send_mode == RIP_V1_V2) query->rip_vers = 2; //version 2 else query->rip_vers = 1;//version 1 (*afswitch[dst->sa_family].af_output)(sock, flags,dst, sizeof (struct rip)); TRACE_OUTPUT(ifp, dst, sizeof (struct rip)); }
void HangStruct::IndentHanging(OutputStruct *pOut) { #ifdef DEBUG TRACE(("--------------------------------------------------------------\n")); TRACE_OUTPUT(pOut); TRACE(("state:%d/%d, parn:%d/%d, curl:%d, agg:%d/%d\n", indent, stmt_level, until_parn, parn_level, curl_level, do_aggreg, in_aggreg)); #endif if (indent != 0 && curl_level != 0 && (until_parn == 0 || parn_level != 0) && until_curl == 0 && in_aggreg < curl_level && !emptyString(pOut -> pCode) && !emptyString(pOut -> pCFlag) && (pOut -> pCFlag[0] == Normal || !ContinuedQuote(pOut))) { pOut -> indentHangs = indent; if (stmt_level && !until_parn) pOut -> indentHangs += stmt_level; TRACE(("HANG:%d\n", pOut -> indentHangs)); } if (pOut -> pType != PreP) { ScanState(pOut -> pCode, pOut -> pCFlag); ScanState(pOut -> pBrace, pOut -> pBFlag); } }
/* * Supply dst with the contents of the routing tables. * If this won't fit in one packet, chop it up into several. */ void supply(struct sockaddr_in6 *sin6, struct interface *ifp, int rtstate, boolean_t splith) { struct rt_entry *rt; struct netinfo6 *n = msg->rip6_nets; struct rthash *rh; int size, i, maxsize; uint8_t rtmetric; msg->rip6_cmd = RIPCMD6_RESPONSE; msg->rip6_vers = RIPVERSION6; /* * Initialize maxsize to the size of the largest RIPng packet supported * on the outgoing interface. */ maxsize = ifp->int_mtu - sizeof (ip6_t) - sizeof (struct udphdr); for (i = IPV6_ABITS; i >= 0; i--) { if (net_hashes[i] == NULL) continue; for (rh = net_hashes[i]; rh < &net_hashes[i][ROUTEHASHSIZ]; rh++) { for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) { if (IN6_IS_ADDR_LINKLOCAL(&rt->rt_dst)) continue; if (IN6_IS_ADDR_UNSPECIFIED(&rt->rt_dst)) continue; /* do not send if private */ if (rt->rt_state & RTS_PRIVATE) continue; /* * Don't resend the information * on the network from which it was received. */ if (splith && rt->rt_ifp != NULL && strcmp(ifp->int_ifbase, rt->rt_ifp->int_ifbase) == 0) { if (dopoison) rtmetric = HOPCNT_INFINITY; else continue; } else { rtmetric = rt->rt_metric; } /* * For dynamic updates, limit update to routes * with the specified state. */ if (rtstate != 0 && (rt->rt_state & rtstate) == 0) continue; /* * Check if there is space for another RTE. If * not, send the packet built up and reset n for * the remaining RTEs. */ size = (char *)n - packet; if (size > maxsize - sizeof (struct netinfo6)) { sendpacket(sin6, ifp, size, 0); TRACE_OUTPUT(ifp, sin6, size); n = msg->rip6_nets; } n->rip6_prefix = rt->rt_dst; n->rip6_route_tag = rt->rt_tag; n->rip6_prefix_length = rt->rt_prefix_length; n->rip6_metric = min(rtmetric, HOPCNT_INFINITY); n++; } /* end of hash chain */ } /* end of particular prefix length */ } /* end of all prefix lengths */ if (n != msg->rip6_nets) { size = (char *)n - packet; sendpacket(sin6, ifp, size, 0); TRACE_OUTPUT(ifp, sin6, size); } }
/* * Supply dst with the contents of the routing tables. * If this won't fit in one packet, chop it up into several. * * This must be done using the split horizon algorithm. * 1. Don't send routing info to the interface from where it was received. * 2. Don't publish an interface to itself. * 3. If a route is received from more than one interface and the cost is * the same, don't publish it on either interface. I am calling this * clones. */ void supply(struct sockaddr *dst, int flags, struct interface *ifp, int changesonly) { struct rt_entry *rt; struct rt_entry *crt; /* Clone route */ struct rthash *rh; struct netinfo *nn; struct netinfo *n = msg->rip_nets; struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) dst; af_output_t *output = afswitch[dst->sa_family].af_output; int size, metric, ticks; union ipx_net net; int delay = 0; if (sipx->sipx_port == 0) sipx->sipx_port = htons(IPXPORT_RIP); msg->rip_cmd = ntohs(RIPCMD_RESPONSE); for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++) { for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) { size = (char *)n - (char *)msg; if (size >= ((MAXRIPNETS * sizeof (struct netinfo)) + sizeof (msg->rip_cmd))) { (*output)(ripsock, flags, dst, size); TRACE_OUTPUT(ifp, dst, size); n = msg->rip_nets; delay++; if(delay == 2) { usleep(50000); delay = 0; } } if (changesonly && !(rt->rt_state & RTS_CHANGED)) continue; /* * This should do rule one and two of the split horizon * algorithm. */ if (rt->rt_ifp == ifp) continue; /* * Rule 3. * Look if we have clones (different routes to the same * place with exactly the same cost). * * We should not publish on any of the clone * interfaces. */ crt = rt->rt_clone; while (crt) { if (crt->rt_ifp == ifp) goto next; crt = crt->rt_clone; } sipx = (struct sockaddr_ipx *)&rt->rt_dst; if ((rt->rt_flags & (RTF_HOST|RTF_GATEWAY)) == RTF_HOST) sipx = (struct sockaddr_ipx *)&rt->rt_router; if (rt->rt_metric == HOPCNT_INFINITY) metric = HOPCNT_INFINITY; else { metric = rt->rt_metric + 1; /* * We don't advertize routes with more than * 15 hops. */ if (metric >= HOPCNT_INFINITY) continue; } /* * XXX One day we should cater for slow interfaces * also. */ ticks = rt->rt_ticks + 1; net = sipx->sipx_addr.x_net; /* * Make sure that we don't put out a two net entries * for a pt to pt link (one for the G route, one for * the if) * This is a kludge, and won't work if there are lots * of nets. */ for (nn = msg->rip_nets; nn < n; nn++) { if (ipx_neteqnn(net, nn->rip_dst)) { if (ticks < ntohs(nn->rip_ticks)) { nn->rip_metric = htons(metric); nn->rip_ticks = htons(ticks); } else if ((ticks == ntohs(nn->rip_ticks)) && (metric < ntohs(nn->rip_metric))) { nn->rip_metric = htons(metric); nn->rip_ticks = htons(ticks); } goto next; } } n->rip_dst = net; n->rip_metric = htons(metric); n->rip_ticks = htons(ticks); n++; next: ; } if (n != msg->rip_nets) { size = (char *)n - (char *)msg; (*output)(ripsock, flags, dst, size); TRACE_OUTPUT(ifp, dst, size); } } }
void supply(struct sockaddr *dst, int flags, struct interface *ifp, int rtstate) { struct rt_entry *rt; struct netinfo *n = msg->rip_nets; struct rthash *rh; struct rthash *base = hosthash; struct cfg_interface *ifcp; int doinghost = 1, size; void (*output)(int,int,struct sockaddr *,int) = afswitch[dst->sa_family].af_output; int (*sendroute)(struct rt_entry *, struct sockaddr *) = afswitch[dst->sa_family].af_sendroute; int npackets = 0; // Kaohj if (!ifp) return; ifcp = (struct cfg_interface *)if_cfg_lookup(ifp->int_name); if (!ifcp || ifcp->send_mode == RIP_NONE) return; //ql_xu #ifdef CONFIG_BOA_WEB_E8B_CH if (ifcp->operation == RIP_IFF_PASSIVE) return; #endif msg->rip_cmd = RIPCMD_RESPONSE; // Kaohj //msg->rip_vers = ripversion; if (ifcp->send_mode == RIP_V1) msg->rip_vers = RIPv1; else msg->rip_vers = RIPv2; // Mason Yu //printf("SEND: RIPv%d Response to %s\n", msg->rip_vers, inet_ntoa(satosin(*dst)->sin_addr)); if(debug) printf("SEND: RIPv%d Response to %s\n", msg->rip_vers, inet_ntoa(satosin(*dst)->sin_addr)); memset(&msg->rip_res1, 0, sizeof(msg->rip_res1)); again: for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++) for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) { /* * Don't resend the information on the network * from which it was received (unless sending * in response to a query). */ if (ifp && rt->rt_ifp == ifp && (rt->rt_state & RTS_INTERFACE) == 0) continue; if (rt->rt_state & RTS_EXTERNAL) continue; //Casey, ignore default route if (!satosin(rt->rt_dst)->sin_addr.s_addr) continue; // /* * For dynamic updates, limit update to routes * with the specified state. */ if (rtstate && (rt->rt_state & rtstate) == 0) continue; /* * Limit the spread of subnet information * to those who are interested. */ if (doinghost == 0 && rt->rt_state & RTS_SUBNET) { if (rt->rt_dst.sa_family != dst->sa_family) continue; if ((*sendroute)(rt, dst) == 0) continue; } size = (char *)n - packet; if (size > MAXPACKETSIZE - (int)sizeof (struct netinfo)) { TRACE_OUTPUT(ifp, dst, size); (*output)(sock, flags, dst, size); /* * If only sending to ourselves, * one packet is enough to monitor interface. */ if (ifp && (ifp->int_flags & (IFF_BROADCAST | IFF_POINTOPOINT | IFF_REMOTE)) == 0) return; n = msg->rip_nets; npackets++; } // Casey, RIP2 n->n_family = AF_INET; n->n_tag = 0; n->n_dst = satosin(rt->rt_dst)->sin_addr.s_addr; // Kaohj //if(ripversion == 2) { if (ifcp->send_mode != RIP_V1) { n->n_mask = satosin(rt->rt_netmask)->sin_addr.s_addr; // Added by Mason Yu // Modified IP Address in RIP packet. The correct IP address is subnet address not route's dst address. n->n_dst &= n->n_mask; } else/* RIP1 */ n->n_mask = 0; n->n_nhop = 0; n->n_metric = htonl(rt->rt_metric); if(debug) { printf(" route: flags=%x, state=%x, timer=%d\n", rt->rt_flags, rt->rt_state, rt->rt_timer); printf(" dest=%s,", inet_ntoa(*(struct in_addr*)&n->n_dst)); printf(" mask=%s,", inet_ntoa(*(struct in_addr*)&n->n_mask)); printf(" nhop=%s,", inet_ntoa(*(struct in_addr*)&n->n_nhop)); printf(" cost=%d\n", n->n_metric); } /* to next entry */ n++; } if (doinghost) { doinghost = 0; base = nethash; goto again; } if (n != msg->rip_nets || (npackets == 0 && rtstate == 0)) { size = (char *)n - packet; TRACE_OUTPUT(ifp, dst, size); (*output)(sock, flags, dst, size); } }
MObject audioAnalyzer::lowScaleAttr; MObject audioAnalyzer::midAttr; MObject audioAnalyzer::midScaleAttr; MObject audioAnalyzer::highAttr; MObject audioAnalyzer::highScaleAttr; MObject audioAnalyzer::sizeAttr; MObject audioAnalyzer::sampleRateAttr; MObject audioAnalyzer::sampleSizeAttr; MObject audioAnalyzer::bpmAttr; // -------- Functions -------- /** Default constructor. */ audioAnalyzer::audioAnalyzer() { TRACE_OUTPUT("audioAnalyzer()") } /** Called when createNode audioNode is called. */ void* audioAnalyzer::creator() { TRACE_OUTPUT("creator()") return new audioAnalyzer(); } MStatus audioAnalyzer::initialize() { TRACE_OUTPUT("initialize()"); try { createAttributes();
void supply(struct sockaddr *dst, int flags, struct interface *ifp, int rtstate) { struct rt_entry *rt; struct netinfo *n = msg->rip_nets; struct rthash *rh; struct rthash *base = hosthash; int doinghost = 1, size; void (*output)(int,int,struct sockaddr *,int) = afswitch[dst->sa_family].af_output; int (*sendroute)(struct rt_entry *, struct sockaddr *) = afswitch[dst->sa_family].af_sendroute; int npackets = 0; msg->rip_cmd = RIPCMD_RESPONSE; msg->rip_vers = RIPVERSION; memset(&msg->rip_res1, 0, sizeof(msg->rip_res1)); again: for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++) for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) { /* * Don't resend the information on the network * from which it was received (unless sending * in response to a query). */ if (ifp && rt->rt_ifp == ifp && (rt->rt_state & RTS_INTERFACE) == 0) continue; if (rt->rt_state & RTS_EXTERNAL) continue; /* * For dynamic updates, limit update to routes * with the specified state. */ if (rtstate && (rt->rt_state & rtstate) == 0) continue; /* * Limit the spread of subnet information * to those who are interested. */ if (doinghost == 0 && rt->rt_state & RTS_SUBNET) { if (rt->rt_dst.sa_family != dst->sa_family) continue; if ((*sendroute)(rt, dst) == 0) continue; } size = (char *)n - packet; if (size > MAXPACKETSIZE - (int)sizeof (struct netinfo)) { TRACE_OUTPUT(ifp, dst, size); (*output)(sock, flags, dst, size); /* * If only sending to ourselves, * one packet is enough to monitor interface. */ if (ifp && (ifp->int_flags & (IFF_BROADCAST | IFF_POINTOPOINT | IFF_REMOTE)) == 0) return; n = msg->rip_nets; npackets++; } n->rip_dst = rt->rt_dst; #if BSD < 198810 if (sizeof(n->rip_dst.sa_family) > 1) /* XXX */ n->rip_dst.sa_family = htons(n->rip_dst.sa_family); #else #define osa(x) ((struct osockaddr *)(&(x))) osa(n->rip_dst)->sa_family = htons(n->rip_dst.sa_family); #endif n->rip_metric = htonl(rt->rt_metric); n++; } if (doinghost) { doinghost = 0; base = nethash; goto again; } if (n != msg->rip_nets || (npackets == 0 && rtstate == 0)) { size = (char *)n - packet; TRACE_OUTPUT(ifp, dst, size); (*output)(sock, flags, dst, size); } }