static void snd_epg_array (int sock, EpgArray * rv) { uint32_t i; ipcSndS (sock, rv->num_pgm); debugMsg ("num_pgm: %d\n", rv->num_pgm); for (i = 0; i < rv->num_pgm; i++) { ipcSndS (sock, rv->pgm_nrs[i]); } for (i = 0; i < rv->num_pgm; i++) { uint32_t j; debugMsg ("num_events: %d\n", rv->sched[i].num_events); ipcSndS (sock, rv->sched[i].num_events); for (j = 0; j < rv->sched[i].num_events; j++) { uint16_t sz; sz = evtGetSize (rv->sched[i].events[j]); debugMsg ("event size: %" PRIu16 "\n", sz); ipcSndS (sock, sz); ioBlkWr (sock, rv->sched[i].events[j], sz); } } }
//*********************************************************************** void ICACHE_FLASH_ATTR easyMesh::handleTimeSync( meshConnectionType *conn, JsonObject& root ) { String timeStamp = root["msg"]; debugMsg( SYNC, "handleTimeSync(): with %d in timestamp=%s\n", conn->chipId, timeStamp.c_str()); conn->time.processTimeStamp( timeStamp ); //varifies timeStamp and updates it with a new one. debugMsg( SYNC, "handleTimeSync(): with %d out timestamp=%s\n", conn->chipId, timeStamp.c_str()); if ( conn->time.num < TIME_SYNC_CYCLES ) { staticThis->sendMessage( conn, _chipId, TIME_SYNC, timeStamp ); } uint8_t odd = conn->time.num % 2; if ( (conn->time.num + odd) >= TIME_SYNC_CYCLES ) { // timeSync completed if ( conn->time.adopt ) { conn->time.calcAdjustment( odd ); // flag all connections for re-timeSync SimpleList<meshConnectionType>::iterator connection = _connections.begin(); while ( connection != _connections.end() ) { if ( connection != conn ) { // exclude this connection connection->timeSyncStatus = NEEDED; } connection++; } } conn->lastTimeSync = getNodeTime(); conn->timeSyncStatus = COMPLETE; } }
/** *\brief finds or creates a new Trk object * *if a new one is created, refcount will be at 1 on return. *if one already exists and is found, refcount will be incremented by 1 on return. *selector is not locked */ static SvcTrk * find_or_new_svt (SwDmx * d, uint16_t pnr) { SvcTrk *t; uint16_t pat_pid = 0; debugMsg ("looking up tracker for pnr: %" PRIu16 "\n", pnr); t = find_svt (d, pnr); debugMsg ("found tracker %p\n", t); if (t == NULL) { t = rcptrMalloc (sizeof (*t)); debugMsg ("creating new tracker %p\n", t); memset (t, 0, sizeof (*t)); t->pnr = pnr; t->pid = 0x1fff; t->input = selectorAddPortSync (&d->s, svt_packet_put, t); pidbufDump ("find_or_new_svt", &pat_pid, 1); selectorModPort (t->input, 1, &pat_pid); t->pmt[0] = NULL; //those start out empty... also will have to dump pms_cache t->pmt[1] = NULL; t->n_out = 0; t->output = NULL; secExInit (&t->ex, t->input, svt_release_pk); //svt_release_pk assumes selector is not locked... debugMsg ("tracker created\n"); } else rcptrAcquire (t); //so it has +1 refcount in both cases.. debugMsg ("returning tracker: %p\n", t); return t; }
int srvListTp (Connection * c) { int num_tp, i; TransponderInfo *t; uint32_t pos; debugMsg ("list_tp start\n"); ipcRcvS (c->sockfd, pos); t = pgmdbListTransp (&c->p->program_database, pos, &num_tp); if (!t) { debugMsg ("pgmdb_list_tp error\n"); ipcSndS (c->sockfd, SRV_ERR); return 1; } ipcSndS (c->sockfd, SRV_NOERR); debugMsg ("success: got %d transponders\n", num_tp); ipcSndS (c->sockfd, num_tp); for (i = 0; i < num_tp; i++) { tpiSnd (c->sockfd, &t[i]); } debugMsg ("freeing transponder array\n"); utlFAN (t); return 0; }
int srvListPg (Connection * c) { int num_pg, i; ProgramInfo *pi; uint32_t freq; uint8_t pol; uint32_t pos; ipcRcvS (c->sockfd, pos); ipcRcvS (c->sockfd, freq); ipcRcvS (c->sockfd, pol); debugMsg ("pgmdbListPgm\n"); pi = pgmdbListPgm (&c->p->program_database, pos, freq, pol, &num_pg); if (!pi) { debugMsg ("pgmdbListPgm error\n"); ipcSndS (c->sockfd, SRV_ERR); return 1; } ipcSndS (c->sockfd, SRV_NOERR); ipcSndS (c->sockfd, num_pg); if (num_pg > 0) { for (i = 0; i < num_pg; i++) { programInfoSnd (c->sockfd, &pi[i]); programInfoClear (&pi[i]); } utlFAN (pi); } return 0; }
int srvSetFcorr (Connection * c) { int32_t fcorr; TransponderInfo t; debugMsg ("set_fcorr start\n"); ipcRcvS (c->sockfd, fcorr); if (!(c->super && c->active)) { ipcSndS (c->sockfd, SRV_ERR); return 0; } if (dvbSetFCorr (&c->p->dvb, fcorr)) { ipcSndS (c->sockfd, SRV_ERR); return 0; } else { //this works because I was lazy and didn't clear the frontend data on tuning failure //TODO: find a sane way of getting at some valid tuning parms if (pgmdbFindTransp (&c->p->program_database, &t, c->p->dvb.pos, c->p->dvb.freq, c->p->dvb.pol)) { ipcSndS (c->sockfd, SRV_NOERR); return 0; } if (!recTaskActive (&c->p->recorder_task)) { debugMsg ("pgmRmvAllPnrs\n"); pgmRmvAllPnrs ((PgmState *) c->p); //iterate over all connections stopping their pnrs/recordings. if (!srvTuneTpi (c->p, c->p->dvb.pos, &t)) { debugMsg ("done\n"); } else { errMsg ("tuning error\n"); ipcSndS (c->sockfd, SRV_ERR); return 1; } } else { errMsg ("error\n"); ipcSndS (c->sockfd, SRV_NOACTIVE); return 1; } ipcSndS (c->sockfd, SRV_NOERR); } return 0; }
int srvTpFt (Connection * c) { debugMsg ("ft_tp\n"); uint32_t freq; uint8_t pol; uint32_t pos; int32_t ft; TransponderInfo t; ipcRcvS (c->sockfd, pos); ipcRcvS (c->sockfd, freq); ipcRcvS (c->sockfd, pol); ipcRcvS (c->sockfd, ft); if (!(c->super && c->active)) { ipcSndS (c->sockfd, SRV_NOACTIVE); return 0; } if (pgmdbFt (&c->p->program_database, pos, freq, pol, ft)) ipcSndS (c->sockfd, SRV_ERR); else { if (pgmdbFindTransp (&c->p->program_database, &t, pos, freq, pol)) { ipcSndS (c->sockfd, SRV_NOERR); return 0; } if (!recTaskActive (&c->p->recorder_task)) { debugMsg ("pgmRmvAllPnrs\n"); pgmRmvAllPnrs ((PgmState *) c->p); //iterate over all connections stopping their pnrs/recordings. if (!srvTuneTpi (c->p, pos, &t)) { debugMsg ("done\n"); } else { errMsg ("tuning error\n"); ipcSndS (c->sockfd, SRV_ERR); return 1; } } else { errMsg ("error\n"); ipcSndS (c->sockfd, SRV_NOACTIVE); return 1; } ipcSndS (c->sockfd, SRV_NOERR); } return 0; }
int cuStackPop (CUStack * st) { if (!st->Index) { return 1; } st->Index--; debugMsg ("popping func addr: %p\n", (void *) st->Stack[st->Index].ff); debugMsg (" Handle: %p\n", st->Stack[st->Index].Handle); st->Stack[st->Index].ff (st->Stack[st->Index].Handle); return 0; }
/* * GC Mark function */ static void rlink_sentence_gc_mark( struct rlink_sentence *ptr ) { debugMsg(( "Marking LinkParser::Sentence %p", ptr )); if ( ptr ) { rb_gc_mark( ptr->dictionary ); rb_gc_mark( ptr->options ); } else { debugMsg(( "Not marking uninitialized rlink_sentence struct" )); } }
void LeftbagdetectorPlugin::onStringParamChanged(const QString& varName, const QString& val){ if(varName == "input_file"){ input_file = val; blobPositionReader.openFile(input_file); debugMsg("input_file set to " + val); } else if(varName == "output_file"){ output_file = val; blobPositionReader.openFile(output_file); debugMsg("output_file set to " + val); } }
/* add indicated functions to svc tracker may have to associate tracker if it's empty... selector is not locked */ void add_func (SvcOut * o, uint16_t pnr, uint16_t func) { unsigned i; debugMsg ("add_func o=%p pnr=%hu func=0x%hx\n", o, pnr, func); /* tracker may be new, pids unknown, what to do? will have to defer */ for (i = 0; i < o->n_funcs; i++) { if (o->r[i].pnr == pnr) { break; } } if (i >= o->n_funcs) { FuncRec r; unsigned s = o->n_funcs; r.pnr = pnr; r.func = func; /* svt may already exist, but is not associated with this svcOut may have to create new svt if new, will not know any pids. starts out empty listening to pat or perhaps grabbing one from pgmdb (rather not as it is blocking operation...) */ debugMsg ("looking for tracker\n"); r.trk = find_or_new_svt (o->dmx, pnr); //refcount gets incremented here //append an element utlAppend1 ((uint8_t **) & o->r, &o->n_funcs, &s, (uint8_t *) & r, sizeof (r)); //associate the other way around s = r.trk->n_out; utlAppend1 ((uint8_t **) & r.trk->output, &r.trk->n_out, &s, (uint8_t *) & o, sizeof (o)); debugMsg ("add_func done\n"); return; } /* here, svt already exists and is associated it may already know all pids, and may be able to supply us with them later .. */ o->r[i].func = func; debugMsg ("add_func done2\n"); return; }
/* selector must not be locked */ static void svt_clear (SvcTrk * t) { debugMsg ("svt_clear \n"); assert (t->n_out == 0); selectorRemovePort (t->input); t->input = NULL; utlFAN (t->output); clear_tbl (t->pmt[0]); utlFAN (t->pmt[0]); clear_tbl (t->pmt[1]); utlFAN (t->pmt[1]); debugMsg ("svt_clear done\n"); }
int cuStackGrow (CUStack * st) { unsigned int size = st->Size + GROW_CU_SIZE; CUStackElem *sp; debugMsg ("Growing Stack\n"); sp = realloc (st->Stack, sizeof (CUStackElem) * size); if (!sp) return 1; debugMsg ("Success\n"); st->Stack = sp; st->Size = size; return 0; }
int cuStackPush (void *handle, void (*ff) (void *handle), CUStack * st) { if (st->Index == (st->Size)) { if (cuStackGrow (st)) return 1; } st->Stack[st->Index].ff = ff; st->Stack[st->Index].Handle = handle; st->Index++; debugMsg ("pushed func addr: %p\n", ff); debugMsg (" Handle: %p\n", handle); return 0; }
int offline_task_vt (OfflineTask * rt) { int num_tp; if (rt->current_tp >= rt->num_tp) { debugMsg ("rt->current_tp>=rt->num_tp\n"); if (rt->current_pos >= rt->num_pos) { debugMsg ("rt->current_pos>=rt->num_pos\n"); utlFAN (rt->tpi); rt->tpi = NULL; rt->current_tp = 0; rt->num_tp = 0; rt->num_pos = 0; rt->current_pos = 0; return 1; } else { debugMsg ("else\n"); utlFAN (rt->tpi); rt->tpi = NULL; do { rt->current_pos++; if (rt->current_pos >= rt->num_pos) { debugMsg ("rt->current_pos>=rt->num_pos\n"); rt->current_tp = 0; rt->num_tp = 0; rt->num_pos = 0; rt->current_pos = 0; return 1; } rt->tpi = pgmdbListTransp (&rt->p->program_database, rt->current_pos, &num_tp); rt->num_tp = num_tp; rt->current_tp = 0; } while (NULL == rt->tpi); } } debugMsg ("ok\n"); return 0; }
void analyzerNode (analyzerCtx* ctx, ast* Node) { debugEnter(astTagGetStr(Node->tag)); if (Node->tag == astEmpty) debugMsg("Empty"); else if (Node->tag == astInvalid) debugMsg("Invalid"); else if (Node->tag == astModule) analyzerModule(ctx, Node); else if (Node->tag == astUsing) analyzerUsing(ctx, Node); else if (Node->tag == astFnImpl) analyzerFnImpl(ctx, Node); else if (Node->tag == astDecl) analyzerDecl(ctx, Node, false); else if (Node->tag == astCode) analyzerCode(ctx, Node); else if (Node->tag == astBranch) analyzerBranch(ctx, Node); else if (Node->tag == astLoop) analyzerLoop(ctx, Node); else if (Node->tag == astIter) analyzerIter(ctx, Node); else if (Node->tag == astReturn) analyzerReturn(ctx, Node); else if (Node->tag == astBreak || Node->tag == astContinue) ; /*Nothing to check (inside loop is a parsing issue)*/ else if (astIsValueTag(Node->tag)) /*TODO: Check not throwing away value*/ analyzerValue(ctx, Node); else debugErrorUnhandled("analyzerNode", "AST tag", astTagGetStr(Node->tag)); debugLeave(); }
static int io_udp_socket6 (char *bcast_addr, uint16_t port, int loop, struct sockaddr_in6 *dest_addr) { int sockfd; debugMsg ("initialising dest_addr\n"); memset ((void *) dest_addr, 0, sizeof (*dest_addr)); if (!inet_pton (AF_INET6, bcast_addr, &dest_addr->sin6_addr)) { errMsg ("failed\n"); return -1; } dest_addr->sin6_port = htons (port); dest_addr->sin6_family = AF_INET6; sockfd = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (sockfd < 0) { errMsg ("Failed to create bcast socket: %s\n", strerror (errno)); return -1; } setsockopt (sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop, sizeof (loop)); return sockfd; }
void videoRTPSession_t::receivedData (RTPPacket_t * packet) { debugMsg(dbg_App_Normal, "videoRTPSession_t", "receivedData 1 SSRC=%d\n", packet->getSSRC() ); channel_t * channel = NULL; if ((channel = channelList->lookUp(packet->getSSRC())) != NULL) { if(channel->getKind() == PLAY_CHANNEL) { playChannel_t * playChannel = static_cast<playChannel_t *>(channel); playChannel->addFragment(packet); } else { delete packet; } } else if(*SetAutoChannel) { NOTIFY("Receiving new flow SSRC = %d. Building playChannel_t...\n", packet->getSSRC() ); char name[20]=""; sprintf(name,"Remote %d",packet->getSSRC()); playChannel_t * playChannel = new playChannel_t(packet->getSSRC(),name); } }
void TagScanner::init() { // Check if ctags exists? QStringList argList; argList.push_back("--version"); QByteArray stdoutContent; int n = execProgram(ETAGS_CMD, argList, &stdoutContent, NULL); QStringList outputList = QString(stdoutContent).split('\n'); for(int u = 0;u < outputList.size();u++) { debugMsg("ETAGS: %s", stringToCStr(outputList[u])); } if(n) { QString msg; msg.sprintf("Failed to start program '%s'\n", ETAGS_CMD); msg += "ctags can be installed on ubuntu/debian using command:\n"; msg + "\n"; msg += " apt-get install exuberant-ctags"; QMessageBox::warning(NULL, "Failed to start ctags", msg); m_ctagsExist = false; } else m_ctagsExist = true; }
void Faceanomaly1Plugin::inputData(const QStringList& strList, QList<QImage> imageList){ int i; frameNum=strList.at(1); if (!strList.at(0).isEmpty()) i= strList.at(0).split(" ")[0].toInt(); if(!imageList.isEmpty()){ imageList.at(0); updateFrameViewer("Output",imageList.at(0).copy()); } if( i>=threasholdFaceCount){ debugMsg(QString("<FONT COLOR='#ff0000'>%1 faces detected on frame %2 ").arg(threasholdFaceCount).arg(frameNum)); generateAlert("Output","Too many people",nooba::RedAlert); } i=0; }
/* selector must not be locked */ static void svt_release (SwDmx * d, SvcTrk * t) { debugMsg ("svt_release d=%p t=%p\n", d, t); if (1 == rcptrRefcount (t)) { debugMsg ("removing tracker\n"); selectorLock (&d->s); secExClear (&t->ex); //selector has to be locked here selectorUnlock (&d->s); btreeNodeRemove (&d->svt_root, &t->n); svt_clear (t); } rcptrRelease (t); debugMsg ("svt_release done\n"); }
/* remove indicated functions from port does not remove corresponding pids from output port has to be done later. may have to modify tracker and dissociate it, if it's not used anymore by this port selector is not locked */ void rmv_func (SvcOut * o, uint16_t pnr, uint16_t func) { unsigned i; /* remove func from out port iterate over SvcOut s FuncRec array */ debugMsg ("rmv_func o=%p pnr=%hu func=0x%hx\n", o, pnr, func); for (i = 0; i < o->n_funcs; i++) { if (o->r[i].pnr == pnr) { break; } } if (i >= o->n_funcs) { errMsg ("pnr not found: 0x%" PRIx16 ",0x%" PRIx16 "\nin SvcOut:%p\n", pnr, func, o); return; } /* clear func bits in svcout if it gets zero, remove tracker */ o->r[i].func &= ~func; //clear func if (o->r[i].func == 0) { remove_tracker (o, i); } }
type* analyzerParamList (analyzerCtx* ctx, ast* Node, type* returnType) { debugEnter("ParamList"); bool variadic = false; type** paramTypes = calloc(Node->children, sizeof(type*)); int paramNo = 0; for (ast* param = Node->firstChild; param; param = param->nextSibling) { /*Ellipsis to indicate variadic function. The grammar has already ensured there is only one and that it is the final parameter.*/ if (param->tag == astEllipsis) { variadic = true; debugMsg("Ellipsis"); } else if (param->tag == astParam) { const type* BasicDT = analyzerDeclBasic(ctx, param->l); const type* paramType = analyzerDeclNode(ctx, param->r, typeDeepDuplicate(BasicDT), false, storageUndefined); paramTypes[paramNo++] = typeDeepDuplicate(paramType); if (!typeIsComplete(paramType)) errorIncompleteParamDecl(ctx, param, Node, paramNo, paramType); } else debugErrorUnhandled("analyzerParamList", "AST tag", astTagGetStr(param->tag)); } type* DT = typeCreateFunction(returnType, paramTypes, paramNo, variadic); debugLeave(); return DT; }
void fatal(const char *fmt, ...) { va_list ap; va_start(ap, fmt); debugMsg(MSG_QUIET, fmt, ap); va_end(ap); _exit(1); }
void NoobaPlugin::initSignalSlots() { connect(_api, SIGNAL(debugMsgRequest(QString)), this, SIGNAL(debugMsg(QString))); connect(_api, SIGNAL(debugMsgRequest(QString)), this, SLOT(onDebugMsg(QString))); connect(_api, SIGNAL(createIntParamRequest(QString,int,int,int)), this, SLOT(onCreateIntParam(QString,int, int, int))); connect(_api, SIGNAL(createDoubleParamRequest(QString,double, double, double)), this, SLOT(onCreateDoubleParam(QString,double, double, double))); connect(_api, SIGNAL(createStringParamRequest(QString,QString, bool)), this, SLOT(onCreateStringParam(QString,QString, bool))); connect(_api, SIGNAL(createMultiValParamRequest(QString,QStringList)), this, SLOT(onCreateMultiValParam(QString,QStringList))); // connect(_api, SIGNAL(createPointParamRequest(QString,QPointF)), this, SLOT(onCreatePointParam(QString,QPointF))); // connect(_api, SIGNAL(createRectParamRequest(QString,QRectF)), this, SLOT(onCreateRectParam(QString,QRectF))); connect(_api, SIGNAL(createFrameViewerRequest(QString,bool)), this, SLOT(onCreateFrameViewer(QString,bool))); connect(_api, SIGNAL(createFilePathParamRequest(QString,QString,nooba::PathType,QString)), this, SLOT(onCreateFilePathParam(QString,QString,nooba::PathType,QString))); connect(_api, SIGNAL(createLineParamRequest(QString,QString,QColor)), this, SLOT(onCreateLineParam(QString,QString,QColor))); // after version 0.10 qRegisterMetaType<PluginPassData>("PluginPassData"); connect(_api, SIGNAL(outputDataRequest(PluginPassData)), this, SIGNAL(outputData(PluginPassData))); qRegisterMetaType< QList<QImage> >("QList<QImage>"); connect(_api, SIGNAL(outputDataRequest(QStringList,QList<QImage>)), this, SIGNAL(outputData(QStringList,QList<QImage>))); connect(_api, SIGNAL(updateFrameViewerRequest(QString,QImage)), this, SLOT(onUpdateFrameViewerRequest(QString,QImage))); connect(_api, SIGNAL(updateFrameViewerVisibilityRequest(QString,bool)), this, SLOT(onSetFrameViewerVisibility(QString, bool))); connect(this, SIGNAL(intParamUpdate(QString,int)), _api, SLOT(onIntParamChanged(QString,int))); connect(this, SIGNAL(doubleParamUpdate(QString,double)), _api, SLOT(onDoubleParamChanged(QString,double))); connect(this, SIGNAL(stringParamUpdate(QString,QString)), _api, SLOT(onStringParamChanged(QString,QString))); connect(this, SIGNAL(filePathParamUpdate(QString,QString)), _api, SLOT(onFilePathParamChanged(QString,QString))); connect(this, SIGNAL(multiValParamUpdate(QString,QString)), _api, SLOT(onMultiValParamChanged(QString,QString))); // connect(this, SIGNAL(pointParamUpdate(QString,QPointF)), _api, SLOT(onPointParamChanged(QString,QPointF))); // connect(this, SIGNAL(rectParamUpdate(QString,QRectF)), _api, SLOT(onRectParamChanged(QString,QRectF))); connect(this, SIGNAL(lineParamUpdate(QString,QString,QLine)), _api, SLOT(onLineParamUpdated(QString,QString,QLine))); qRegisterMetaType<nooba::AlertType>("nooba::AlertType"); connect(_api, SIGNAL(generateAlertRequest(QString,QString,nooba::AlertType)), this, SLOT(onGenerateAlert(QString,QString,nooba::AlertType))); }
// timeSync Functions //*********************************************************************** uint32_t ICACHE_FLASH_ATTR easyMesh::getNodeTime( void ) { uint32_t ret = system_get_time() + timeAdjuster; debugMsg( GENERAL, "getNodeTime(): time=%d\n", ret); return ret; }
/** *\brief get a timestamp truncated to the past hour */ time_t epg_get_buf_time (void) { time_t a; long d, m, y; uint32_t mjd; struct tm result; // pthread_mutex_lock (&tzmutex); a = time (NULL); #ifdef __WATCOMC__ _gmtime (&a, &result); #else gmtime_r (&a, &result); #endif result.tm_min = 0; result.tm_sec = 0; /* b) To find MJD from Y, M, D If M = 1 or M = 2, then L = 1; else L = 0 MJD = 14 956 + D + int [ (Y - L) × 365,25] + int [ (M + 1 + L × 12) × 30,6001 ] */ d = result.tm_mday; m = result.tm_mon + 1; y = result.tm_year; mjd = get_mjd (d, m, y); debugMsg ("BUF_MJD: %" PRIu32 "\n", mjd); // pthread_mutex_unlock (&tzmutex); return (mjd - MJD_EPOCH) * 86400 + get_time_hms (result.tm_hour, 0, 0); // b=mktime(&result); // return b; }
/* * call-seq: * sentence.parse( options={} ) -> fixnum * * Attach a parse set to this sentence and return the number of linkages * found. If any +options+ are specified, they override those set in the * sentence's dictionary. * */ static VALUE rlink_sentence_parse( int argc, VALUE *argv, VALUE self ) { struct rlink_sentence *ptr = get_sentence( self ); Parse_Options opts; VALUE defopts = Qnil; VALUE options = Qnil; int link_count = 0; /* if ( RTEST(ptr->parsed_p) ) rb_raise( rlink_eLpError, "Can't reparse a sentence." ); */ debugMsg(( "Parsing sentence <%p>", ptr )); /* Merge the hash from this call with the one from the dict and build Parse_Options from it. */ rb_scan_args( argc, argv, "01", &options ); defopts = rb_funcall( ptr->dictionary, rb_intern("options"), 0 ); /* Turn the option hash into a ParseOptions object, then extract the Parse_Options struct from that */ options = rlink_make_parse_options( defopts, options ); opts = rlink_get_parseopts( options ); /* Parse the sentence */ if ( (link_count = sentence_parse( ptr->sentence, opts )) < 0 ) rlink_raise_lp_error(); ptr->options = options; ptr->parsed_p = Qtrue; return INT2FIX( link_count ); }
static int io_udp_socket4 (char *bcast_addr, uint16_t port, int bcast_ttl, int loop, struct sockaddr_in *dest_addr) { int sockfd; debugMsg ("initialising dest_addr\n"); memset ((void *) dest_addr, 0, sizeof (*dest_addr)); #ifdef __WIN32__ dest_addr->sin_addr.S_un.S_addr = inet_addr (bcast_addr); #else if (!inet_pton (AF_INET, bcast_addr, &dest_addr->sin_addr)) { errMsg ("failed\n"); return -1; } #endif dest_addr->sin_port = htons (port); dest_addr->sin_family = AF_INET; sockfd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sockfd < 0) { errMsg ("Failed to create bcast socket: %s\n", strerror (errno)); return -1; } #ifndef __WIN32__ setsockopt (sockfd, SOL_IP, IP_MULTICAST_TTL, &bcast_ttl, sizeof (bcast_ttl)); setsockopt (sockfd, SOL_IP, IP_MULTICAST_LOOP, &loop, sizeof (loop)); #endif return sockfd; }
int find_opt (int argc, char *argv[], char *key) { int i = 0; debugMsg ("looking for cmdline argument %s\n", key); for (i = 1; i < argc; i++) { debugMsg ("seen %s\n", argv[i]); if (!strcmp (argv[i], key)) { debugMsg ("matches\n"); return 1; } } debugMsg ("not found\n"); return 0; }