Beispiel #1
0
Datei: layout.c Projekt: ekg/mars
static void adjust_anchors(Agraph_t* g, int* anchors, int k, mat z)
{
    int i, j;
    double* centroid = (double*) malloc(sizeof(double)*z->c);
    for(i = 0; i < k; i++) {
        Agnode_t* n = get_node(anchors[i]);
        Agedge_t* e;
        int degree = 0;
        for(j = 0; j < z->c; j++) {
            centroid[j] = 0;        
        }
        for(e = agfstedge(g,n); e; e = agnxtedge(g,e,n)) {
            int v = (n == aghead(e)) ? getid(agtail(e)) : getid(aghead(e));
            for(j = 0; j < z->c; j++) {
                centroid[j] += z->m[mindex(v,j,z)];         
            }
            degree++;       
        }
        for(j = 0; j < z->c; j++) {
            if(degree != 0)
                centroid[j] /= degree;
            z->m[mindex(anchors[i],j,z)] = centroid[j];
        }
    }
    free(centroid);
}
Beispiel #2
0
static void
show_status(const char* dev, int s)
{
	int len;
	int i;
	int num;
	uint8_t data[32];

	if (getid(s, dev, -1, data, sizeof(data), &len, 0) < 0) {
		fprintf(stderr, "error: not a wifi device\n");
		exit(1);
	}

	if (get80211val(s, dev, IEEE80211_IOC_NUMSSIDS, &num) < 0)
		num = 0;
	printf("ssid ");
	if (num > 1) {
		for (i = 0; i < num; i++) {
			if (getid(s, dev, i, data, sizeof(data), &len, 0) >= 0
				&& len > 0) {
				printf(" %d:", i + 1);
				print_string(data, len);
			}
		}
	} else
		print_string(data, len);

	printf("\n");
}
Beispiel #3
0
int Hpack_index_table::hpack_encode(unsigned char* buf, const char* Name, const char* value) {
    if(!hpack_inited)
        init_hpack();
    
    unsigned char *buf_begin = buf;
    std::string name;
    while(*Name) {
        name += tolower(*Name++);
    }
    uint32_t index = getid(name, value);
    if(index){
        *buf = 0x80;
        buf += integer_encode(buf, 7, index);
    }else if((index = getid(name))) {
        *buf = 0x40;
        buf += integer_encode(buf, 6, index);
        buf += literal_encode(buf, value);
        add_dynamic_table(name, value);
    }else {
        *buf = 0x40;
        buf++;
        buf += literal_encode(buf, name);
        buf += literal_encode(buf, value);
        add_dynamic_table(name, value);
    }
    return buf - buf_begin;
}
Beispiel #4
0
string Autobits::gen_name(Macuse & mu)
{
    Unumber v = val(mu);
    if (mu.children.size() != 4) throw Err(LNFUN);
    string bit0 = getid(mu.children[2]);
    string bit1 = getid(mu.children[3]);
    return gen_name(v, bit0, bit1);
}
Beispiel #5
0
void
read_lat_file()
{
	unsigned int	src_id;
	unsigned int	dst_id;
	int 		latency;
	int		rv;
	int		i;

	char src[80];
	char dst[80];
	struct rocket_fuel_node *n;

	while(1)
	{
		if(EOF == (rv = fscanf(g_lat_file, "%s %s %d\n", 
				src, dst, &latency)))
			break;

		printf("src: %d dst: %d latency: %d \n",
			src_id, dst_id, latency);

		src_id = getid(src);
		dst_id = getid(dst);

/*
		for(i = 0; i < g_node_count; i++)
		{
printf("Checking node: %d, num links %d (%d)\n", 
			g_node_list[i].id, g_node_list[i].num_links,
			g_node_count);

			if(g_node_list[i].id == src_id)
			{
				n = &g_node_list[i];
				break;
			}
		}
*/
		n = &g_node_list[src_id];
		printf("node %d has %d links \n", src_id, n->num_links);
		for(i = 0; i < n->num_links; i++)
		{
			if(n->link_list[i].node_id == dst_id)
			{
				printf("found link \n");
			}
		}
	}

	fclose(g_lat_file);

	exit(1);
}
Beispiel #6
0
struct building *getbuilding(const struct region *r)
{
    building *b = findbuilding(getid());
    if (b == NULL || r != b->region)
        return NULL;
    return b;
}
int main(){

    int i,j,k,l,test,t=1;

    //freopen("in.txt","r",stdin);

    scanf("%d",&test);

    while(test--){

        scanf("%d %d",&r,&c);

        for(i=1;i<=r*c;i++){
            scanf("%d",&a[i]);
        }
        int ans=0;

        int flag=0;
        for(i=r;i>=1;i--){
            if(flag) j=c;
            else j=c-1;

            for(;j>=1;j-=2){
                ans^=a[getid(i,j)];
            }
            flag=!flag;
        }

        if(!ans) printf("Case %d: lose\n",t++);
        else printf("Case %d: win\n",t++);

    }

    return 0;
}
int car_module::readdate()
{
	FILE* fpin;
	fpin=fopen("date.txt","r");
	if(fpin==NULL)
	{
		printf("can not open date.txt\n");
		return 1;
	}
	fscanf(fpin,"%d\n",&mac);
	fscanf(fpin,"%d%d\n",&rows,&cols);
	fscanf(fpin,"%lf%lf\n",&speed_rows,&speed_cols);
	sumcar=rows*cols;
	spendcar=0;
	for(int i=0;i<rows*cols;i++)
	{
		speed_location tmp;
		fscanf(fpin,"%d",&tmp.id);
		tmp.idle=judgeposition(tmp.id);
		tmp.id=getid(tmp.id)-1;

		if(tmp.idle==2)sumcar--;
		if(!tmp.idle)spendcar++;

		//突然发现不需要用到rows值计算时间
		//难怪一直找不到问题出在哪
		tmp.time=(tmp.id/cols)/speed_rows+(tmp.id%cols)/speed_cols;
		map_queue.push_back(tmp);
	}
	fclose(fpin);
	countqueue();
	return 0;
}
Beispiel #9
0
int main(int argc, char* argv[])
{
	struct marsopts opts = init(argc, argv);
	Agraph_t* g = agread(opts.fin, (Agdisc_t*)NULL);
	Agnode_t* n;
	mat z;
	
	init_graph(g);
	z = mars(g, opts);
	mat_scalar_mult(z, opts.scale);

    if(opts.viewer) {
        viewer(argc, argv);
    } else {
	    for(n = agfstnode(g); n; n = agnxtnode(g,n)) {
		    int id = getid(n);
		    char* s = pos_to_str(&z->m[mindex(id, 0, z)], z->c);
		    agset(n,"pos",s);
		    free(s);
	    }
	
	    agwrite(g, opts.fout);
	}
	mat_free(z);
	clean_up(g);
	agclose(g);
	return 0;
}
Beispiel #10
0
/**
 ** GM: TELEPORT <unit> <x> <y>
 ** requires: permission-key "gmtele"
 **/
static void gm_teleport(const void *tnext, struct unit *u, struct order *ord)
{
  const struct plane *p = rplane(u->region);
  unit *to = findunit(getid());
  int x = rel_to_abs(p, u->faction, getint(), 0);
  int y = rel_to_abs(p, u->faction, getint(), 1);
  region *r = findregion(x, y);

  if (r == NULL || p != rplane(r)) {
    mistake(u, ord, "region is in another plane.");
  } else if (to == NULL) {
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
  } else if (rplane(to->region) != rplane(r) && !ucontact(to, u)) {
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_no_contact",
        "target", to));
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmtele"))) {
      mistake(u, ord, "permission denied.");
    } else
      move_unit(to, r, NULL);
  }
}
void preSUBSTR(string &line, RawSource *) {
    string e;
    int pos=1,len=BIGVALUE;
    string r,s,d=getid(line);
    skipblanks(line);
    line=ReplaceDefines(line);
    getstring(line,e);
    if(comma(line)) {
        if(!ParseExpression(line,pos)) {
            error("Syntax error");
            pos=1;
        }
        if(comma(line)) {
            if(!ParseExpression(line,len)) {
                error("Syntax error");
                len=BIGVALUE;
            }
        }
    }
    checkjunk(line);
    if (pos<1 || pos>(int)e.size()) r="";
    else r=e.substr(pos-1,len);
    makestring(r);
    deftab.add(d,'"'+r+'"');
}
Beispiel #12
0
/**
 ** GM: SKILL <unit> <skill> <tage>
 ** requires: permission-key "gmskil"
 **/
static void gm_skill(const void *tnext, struct unit *u, struct order *ord)
{
  unit *to = findunit(getid());
  skill_t skill = findskill(getstrtoken(), u->faction->locale);
  int num = getint();

  if (to == NULL || rplane(to->region) != rplane(u->region)) {
    /* unknown or in another plane */
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
  } else if (skill == NOSKILL || skill == SK_MAGIC || skill == SK_ALCHEMY) {
    /* unknown or not enough */
    mistake(u, ord, "unknown skill, or skill cannot be raised.");
  } else if (num < 0 || num > 30) {
    /* sanity check failed */
    mistake(u, ord, "invalid value.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmskil"))) {
      mistake(u, ord, "permission denied.");
    } else {
      set_level(to, skill, num);
    }
  }
}
Beispiel #13
0
/**
 ** GM: TAKE <unit> <int> <itemtype>
 ** requires: permission-key "gmtake"
 **/
static void gm_take(const void *tnext, struct unit *u, struct order *ord)
{
  unit *to = findunit(getid());
  int num = getint();
  const item_type *itype = finditemtype(getstrtoken(), u->faction->locale);

  if (to == NULL || rplane(to->region) != rplane(u->region)) {
    /* unknown or in another plane */
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
  } else if (itype == NULL || i_get(to->items, itype) == 0) {
    /* unknown or not enough */
    mistake(u, ord, "invalid item or item not found.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmtake"))) {
      mistake(u, ord, "permission denied.");
    } else {
      int i = i_get(to->items, itype);
      if (i < num)
        num = i;
      if (num) {
        i_change(&to->items, itype, -num);
        i_change(&u->items, itype, num);
      }
    }
  }
}
Beispiel #14
0
/**
 ** GM: TELL <unit> <string>
 ** requires: permission-key "gmmsgr"
 **/
static void gm_messageunit(const void *tnext, struct unit *u, struct order *ord)
{
  const struct plane *p = rplane(u->region);
  unit *target = findunit(getid());
  const char *msg = getstrtoken();
  region *r;

  if (target == NULL) {
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
    return;
  }

  r = target->region;

  if (r == NULL || p != rplane(r)) {
    mistake(u, ord, "region is in another plane.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmmsgu"))) {
      mistake(u, ord, "permission denied.");
    } else {
      add_message(&target->faction->msgs,
        msg_message("regionmessage", "region sender string", r, u, msg));
    }
  }
}
Beispiel #15
0
/**
 ** GM: KILL FACTION <id> <string>
 ** requires: permission-key "gmmsgr"
 **/
static void gm_killfaction(const void *tnext, struct unit *u, struct order *ord)
{
  int n = getid();
  faction *f = findfaction(n);
  const char *msg = getstrtoken();
  plane *p = rplane(u->region);
  attrib *permissions = a_find(u->faction->attribs, &at_permissions);
  if (!permissions || !has_permission(permissions, atoi36("gmkill"))) {
    mistake(u, ord, "permission denied.");
    return;
  }
  if (f != NULL) {
    region *r;
    for (r = regions; r; r = r->next)
      if (rplane(r) == p) {
        unit *target;
        for (target = r->units; target; target = target->next) {
          if (target->faction == f) {
            scale_number(target, 0);
            ADDMSG(&target->faction->msgs, msg_message("killedbygm",
                "region unit string", r, target, msg));
            return;
          }
        }
      }
  }
  mistake(u, ord, "cannot remove a unit from this faction.");
}
Beispiel #16
0
static void
gm_messagefaction(const void *tnext, struct unit *gm, struct order *ord)
{
  int n = getid();
  faction *f = findfaction(n);
  const char *msg = getstrtoken();
  plane *p = rplane(gm->region);
  attrib *permissions = a_find(gm->faction->attribs, &at_permissions);
  if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
    mistake(gm, ord, "permission denied.");
    return;
  }
  if (f != NULL) {
    region *r;
    for (r = regions; r; r = r->next)
      if (rplane(r) == p) {
        unit *u;
        for (u = r->units; u; u = u->next)
          if (u->faction == f) {
            add_message(&f->msgs, msg_message("msg_event", "string", msg));
            return;
          }
      }
  }
  mistake(gm, ord, "cannot send messages to this faction.");
}
Beispiel #17
0
void XLayerImage::Draw( float x, float y, const D3DXMATRIX &m, XSprObj *pParentSprObj )
{
	XSprite *pSpr = m_pSpriteCurr;
	if( pSpr )
	{
		const XE::VEC2 vLocal = GetcnPos().m_vPos;
		pSpr->SetAdjustAxis( GetfAdjustAxisX(), GetfAdjustAxisY() );		// 회전축을 보정함
		pSpr->SetRotateZ( GetcnRot().fAngle );
		pSpr->SetScale( GetcnScale().vScale );
		pSpr->SetFlipHoriz( (GetcnEffect().dwDrawFlag & EFF_FLIP_HORIZ) ? TRUE : FALSE );
		pSpr->SetFlipVert( (GetcnEffect().dwDrawFlag & EFF_FLIP_VERT) ? TRUE : FALSE );
		pSpr->SetDrawMode( GetcnEffect().DrawMode );
		pSpr->SetfAlpha( GetcnEffect().fAlpha );
		//
		if( TOOL->GetspSelLayer()
			&& TOOL->GetspSelLayer()->getid() == getid() ) {
			D3DXVECTOR4 vOut;
			D3DXVECTOR2 dvLocal = vLocal;
			D3DXVec2Transform( &vOut, &dvLocal, &m ); 
			XE::VEC2 vLT = vLocal + pSpr->GetAdjust();
			XE::VEC2 vRB = vLT + pSpr->GetSize();
			D3DXVECTOR2 dvLT = vLT;
			D3DXVECTOR2 dvRB = vRB;
			D3DXVec2Transform( &vOut, &dvLT, &m );		dvLT.x = vOut.x;	dvLT.y = vOut.y;
			D3DXVec2Transform( &vOut, &dvRB, &m );	dvRB.x = vOut.x;	dvRB.y = vOut.y;
			vLT = dvLT;
			vRB = dvRB;
			if( SPROBJ->IsPause() ) {
				XE::DrawRectangle( vLT, vRB, XCOLOR_WHITE );
			}
		}
		//
		pSpr->Draw( vLocal, m );
	}
}
Beispiel #18
0
/**
 ** GM: GATE <id> <x> <y>
 ** requires: permission-key "gmgate"
 **/
static void gm_gate(const void *tnext, struct unit * u, struct order *ord)
{
  const struct plane *pl = rplane(u->region);
  int id = getid();
  int x = rel_to_abs(pl, u->faction, getint(), 0);
  int y = rel_to_abs(pl, u->faction, getint(), 1);
  building *b = findbuilding(id);
  region *r;

  pnormalize(&x, &y, pl);
  r = findregion(x, y);
  if (b == NULL || r == NULL || pl != rplane(b->region) || pl != rplane(r)) {
    mistake(u, ord, "the unit cannot transform this building.");
    return;
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (permissions && has_permission(permissions, atoi36("gmgate"))) {
      remove_triggers(&b->attribs, "timer", &tt_gate);
      remove_triggers(&b->attribs, "create", &tt_unguard);
      if (r != b->region) {
        add_trigger(&b->attribs, "timer", trigger_gate(b, r));
        add_trigger(&b->attribs, "create", trigger_unguard(b));
        fset(b, BLD_UNGUARDED);
      }
    }
  }
}
Beispiel #19
0
int main()
{
	char buf[100];
	if(getname(0, buf, sizeof(buf))==-1){exit(-1);}
	int id = getid("soft01");
	if(id==-1){exit(-1);}
	printf("%s\n%d\n",buf,id);
}
Beispiel #20
0
void HockeyDrop::draw_if(freetype::font_data* base) {
	base->print(340, 500, 0, "\x10");
	for (signed char i = 0; i <= 3; ++i) {
		if (user_state + i <= MAX_USER_STATE)
			base->print(360, (float) (500-20*i), 0, "%c %2hhd: %s", 
			getid(user_state+i), user_state+i, getstring(user_state+i).substr(0,30).c_str());
	}
}
void preTOSTR(string &line, RawSource *) {
    string d=getid(line);
    skipblanks(line);
    string l=ReplaceDefines(line);
    makestring(l);
    line.clear();
    deftab.add(d,'"'+l+'"');
}
Beispiel #22
0
int CodesObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = TSqlObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getid(); break;
        case 1: *reinterpret_cast< QString*>(_v) = gettitle(); break;
        case 2: *reinterpret_cast< QString*>(_v) = getcode(); break;
        case 3: *reinterpret_cast< QString*>(_v) = getcode_url(); break;
        case 4: *reinterpret_cast< int*>(_v) = getstatus(); break;
        case 5: *reinterpret_cast< QDateTime*>(_v) = getcreated_at(); break;
        case 6: *reinterpret_cast< QDateTime*>(_v) = getupdated_at(); break;
        case 7: *reinterpret_cast< int*>(_v) = geteditable(); break;
        case 8: *reinterpret_cast< int*>(_v) = getuser_id(); break;
        case 9: *reinterpret_cast< QString*>(_v) = getshow_from(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setid(*reinterpret_cast< int*>(_v)); break;
        case 1: settitle(*reinterpret_cast< QString*>(_v)); break;
        case 2: setcode(*reinterpret_cast< QString*>(_v)); break;
        case 3: setcode_url(*reinterpret_cast< QString*>(_v)); break;
        case 4: setstatus(*reinterpret_cast< int*>(_v)); break;
        case 5: setcreated_at(*reinterpret_cast< QDateTime*>(_v)); break;
        case 6: setupdated_at(*reinterpret_cast< QDateTime*>(_v)); break;
        case 7: seteditable(*reinterpret_cast< int*>(_v)); break;
        case 8: setuser_id(*reinterpret_cast< int*>(_v)); break;
        case 9: setshow_from(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 10)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
static void test_getintegers(CuTest *tc) {
    init_tokens_str("ii 666 666 -42 -42");
    CuAssertIntEquals(tc, 666, getid());
    CuAssertIntEquals(tc, 666, getint());
    CuAssertIntEquals(tc, 666, getuint());
    CuAssertIntEquals(tc, -42, getint());
    CuAssertIntEquals(tc, 0, getuint());
    CuAssertIntEquals(tc, 0, getint());
}
int pregetdef(string &line,string &n, string &r, StringList &a) {
    a.clear();
    if ((n=getid(line)).empty()) {
        error1("Illegal define name");
        return 0;
    }
    if (line[0]=='(') {
        line.erase(0,1);
        while(1) {
            a.push_back(getid(line));
            if (sbcneed(line,')')) break;
            if (!needcomma(line)) break;
        }
    }
    skipblanks(line);
    r=line;
    line.clear();
    return 1;
}
void preSTRLEN(string &line, RawSource *) {
    string e;
    string d=getid(line);
    skipblanks(line);
    string p=ReplaceDefines(line);
    line.clear();
    getstring(p,e);
    checkjunk(p);
    deftab.add(d,tostr(e.size()));
}
void preASSIGN(string &line, RawSource *) {
    string d=getid(line);
    string p=ReplaceDefines(line);
    line.clear();
    int val;
    if (!ParseExpression(p,val)) error1("Expression expected");
    if (labelnotfound) error1("Forward reference");
    checkjunk(p);
    deftab.add(d,tostr(val));
}
Beispiel #27
0
std::string IOComponent::info()
{
	char buffer[512] = { 0 };
	snprintf(buffer, sizeof(buffer) - 1, "id:%lu type:%d state:%d used:%d fd:%d addr:%s peer:%s "
			"last_use_time %lu", getid(), get_type(), get_state(), is_used(),
	        _socket->get_fd(), _socket->get_addr().c_str(), _socket->get_peer_addr().c_str(),
	        get_last_use_time());

	return buffer;
}
Beispiel #28
0
int main()
{
	welcome();
	printf("2011:%d, 2012:%d\n",isleap(2011),isleap(2012));
	printf("soft01:%d\n", getid("soft01"));
	time_t now = time(NULL);
	printf("time:%s\n",timestr(localtime(&now)));
	char buf[100];
	printf("1234543:%s\n", itoa(1234543,buf,sizeof(buf)));
	return 0;
}
Beispiel #29
0
static void getsym(void) {
  for(;;) {
    if(0<=cc&&cc<=' ') {getcc(); continue;}
    switch(cc) {
    case -1: sym=SYM_EOF; return;
    case '#': do getcc(); while(cc!='\n'&&cc!='\r'); getcc(); continue;
    case '{':
      if(sym==SYM_VALD||sym==SYM_NVAL) {
	getrng(); sym=SYM_RENG;
      } else {
	getcc(); sym=SYM_LCUR;
      }
      return;
    case '}': getcc(); sym=SYM_RCUR; return;
    case '!': getcc();
      if(cc=='~') {
	getcc(); sym=SYM_NMTC;
      } else {
	if(getid()) {
	  if(strcmp("valid",value)!=0) {error(ARX_ER_EXP,sym2str(SYM_NVAL),value);} sym=SYM_NVAL;
	} else {error(ARX_ER_SYN); sym=SYM_INVL;}
      }
      return;
    case '=': getcc();
      switch(cc) {
      case '~': getcc(); sym=SYM_MTCH; return;
      case '>': getcc(); if(sym!=SYM_RGXP) error(ARX_ER_SYN); continue;
      default: sym=SYM_ASGN; return;
      }
    case '"': getq(); sym=SYM_LTRL; return;
    case '/': getq(); sym=SYM_RGXP; return;
    default:
      if(getid()) {
	sym=strcmp("grammars",value)==0?SYM_GRMS
	 : strcmp("valid",value)==0?SYM_VALD:SYM_IDNT;
      } else {getcc(); error(ARX_ER_SYN); sym=SYM_INVL;}
      return;
    }
  }
}
Beispiel #30
0
void pkt(struct lfc *lfc, void *pdata,
         struct lfc_flow *lf, void *data,
         double ts, bool up, bool is_new, libtrace_packet_t *pkt)
{
    struct ndpi *nd = pdata;
    struct flow *f = data;
    struct ipoque_id_struct *srcid, *dstid;
    uint8_t *iph;
    uint16_t et;
    uint32_t rem;
    uint64_t time;

    if (!f->ipq_flow)
        f->ipq_flow = mmatic_zalloc(nd->mm, ipoque_detection_get_sizeof_ipoque_flow_struct());

    iph = trace_get_layer3(pkt, &et, &rem);
    time = ts * 1000;

    srcid = getid(nd, &lf->src);
    dstid = getid(nd, &lf->dst);

    f->proto = ipoque_detection_process_packet(
                   nd->ipq, f->ipq_flow, iph, rem, time, srcid, dstid);
}