U8 logic_radioMeterAddr(U8* meterAddr, flow_err_string_ptr pError) { db_mFrame_str dbFrameStr = { 0 }; meter_frame_info_str protoStr = { 0 }; flow_error_str flowErrFloatStr = { 0 }; U32 infoIdx = 0; U8 buf[FRAME_MAX_LEN] = { 0 }; U16 bufSize = 0; printBuf(NULL, 0, FILE_LINE); db_getCongfig(config_meter_type, (U8*)&infoIdx); if (db_getFrameInfo(infoIdx, &dbFrameStr) == ERROR) { printBuf(NULL, 0, FILE_LINE); return ERROR; } printBuf(NULL, 0, FILE_LINE); dbFrameToProto(&dbFrameStr, &protoStr); protoR_radioMAddr(buf, &bufSize, &protoStr); printBuf(buf, bufSize, FILE_LINE); if (logic_sendAndRead(buf, &bufSize, UART_WAIT_SHORT) == ERROR) { Lib_printf("no response from device\n"); return ERROR; } printBuf(buf, bufSize, FILE_LINE); if (protoA_meterAddr(buf, bufSize, &protoStr, &gOldCoe) == ERROR) { return ERROR; } binAddrToStr(protoStr.meterAddr, meterAddr); coeToErr(&gOldCoe, &flowErrFloatStr); binErrToStr(&flowErrFloatStr, pError); return NO_ERR; }
void NetlinkManager::deleteRouteViaFbossThrift(struct nl_addr* nlDst) { IpPrefix prefix = nlAddrToIpPrefix(nlDst); eb_->runInEventBaseThread([this, prefix]() { FbossClient fbossClient = getFbossClient(FLAGS_ip, FLAGS_fboss_port); fbossClient->future_deleteUnicastRoute(FBOSS_CLIENT_ID, prefix) .then([]() { VLOG(2) << "NetlinkManager route delete success"; }) .onError([prefix](const std::exception& ex) { BinaryAddress binaryDst = prefix.ip; VLOG(2) << folly::sformat( "Route delete failed for destination {}. Error sending thrift calls to FBOSS agent: {}", binAddrToStr(binaryDst), ex.what()); }); }); }
void NetlinkManager::addRouteViaFbossThrift( struct nl_addr* nlDst, const std::vector<BinaryAddress>& nexthops) { UnicastRoute unicastRoute; unicastRoute.dest = nlAddrToIpPrefix(nlDst); unicastRoute.nextHopAddrs = nexthops; eb_->runInEventBaseThread([this, unicastRoute]() { FbossClient fbossClient = getFbossClient(FLAGS_ip, FLAGS_fboss_port); fbossClient->future_addUnicastRoute(FBOSS_CLIENT_ID, unicastRoute) .then([]() { VLOG(2) << "NetlinkManager route add success"; }) .onError([unicastRoute](const std::exception& ex) { BinaryAddress binaryDst = unicastRoute.dest.ip; VLOG(2) << folly::sformat( "Route add failed for destination {}. Error sending thrift calls to FBOSS agent: {}", binAddrToStr(binaryDst), ex.what()); }); }); }