Example #1
0
void Cs2ethInit(Cs2ethStruct *Data, BOOL Verbose, char *Iface, char *Addr,
                int Port, BOOL SendBc, char *BcAddr
#ifdef TRACE
               , BOOL Trace
#endif
               )
{
   Cs2ethSetVerbose(Data, Verbose);
   if (Cs2ethGetVerbose(Data))
   {
      puts("init mrcs2eth");
      printf("     iface %s\n", Iface);
      printf("     addr %s\n", Addr);
      printf("     port %d\n", Port);
      printf("     bc addr %s\n", BcAddr);
   }
#ifdef TRACE
   Cs2ethSetTrace(Data, Trace);
#endif
   Cs2ethSetSendUdpBc(Data, SendBc);
   Cs2ethSetUdpConnected(Data, FALSE);
   Cs2ethSetInterface(Data, Iface);
   Cs2ethSetAddress(Data, Addr);
   Cs2ethSetBcIp(Data, BcAddr);
   Cs2ethSetServerPort(Data, Port);
   Cs2ethSetClientSock(Data, -1);
   Cs2ethSetOutsideUdpSock(Data, -1);
   Cs2ethSetOutsideTcpSock(Data, -1);
   memset((void *)(&(Cs2ethGetClientAddr(Data))), 0,
          sizeof(struct sockaddr_in));
   MengeInit(Cs2ethGetClients(Data), ClientCompare, free);
}
Example #2
0
void CanMemberDelAllInvalid(CanMemberStruct *Data)
{  Menge *MemberToDel;
   MengeIterator IterToDel;
   CollectStruct Collector;
   unsigned long *UidToDel;

   MemberToDel = MengeCreate();
   MengeInit(MemberToDel, MemberDelCmp, (MengeDelCbFkt)free);
   Collector.CanMemberDb = CanMemberGetCanMemberDb(Data);
   Collector.MemberToDel = MemberToDel;
   MapWalkAscend(CanMemberGetCanMemberDb(Data), (MapWalkCbFkt)CollectInvalid,
                 (void *)&Collector);
   MengeInitIterator(&IterToDel, MemberToDel);
   UidToDel = (unsigned long *)MengeFirst(&IterToDel);
   while (UidToDel != 0l)
   {
      MapDel(CanMemberGetCanMemberDb(Data), (MapKeyType)*UidToDel);
      UidToDel = (unsigned long *)MengeNext(&IterToDel);
   }
   MengeDestroy(MemberToDel);
}