Show
Ignore:
Timestamp:
04/14/06 13:26:50 (4 years ago)
Author:
ahu
Message:

implement stunningly cool spoofing protection, plus spoofer in dnspbench

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/mtasker.hh

    r681 r699  
    5151  std::queue<int> d_zombiesQueue; 
    5252 
     53 
     54  typedef std::map<int, ucontext_t*> mthreads_t; 
     55  mthreads_t d_threads; 
     56  int d_tid; 
     57  int d_maxtid; 
     58  size_t d_stacksize; 
     59 
     60  EventVal d_waitval; 
     61  enum {Error=-1,TimeOut=0,Answer} d_waitstatus; 
     62 
     63public: 
    5364  struct Waiter 
    5465  { 
     
    5869    int tid; 
    5970  }; 
    60  
    61   //  typedef std::map<EventKey,Waiter> waiters_t; 
    6271 
    6372  typedef multi_index_container< 
     
    7180  waiters_t d_waiters; 
    7281 
    73   typedef std::map<int, ucontext_t*> mthreads_t; 
    74   mthreads_t d_threads; 
    75   int d_tid; 
    76   int d_maxtid; 
    77   size_t d_stacksize; 
    78  
    79   EventVal d_waitval; 
    80   enum {Error=-1,TimeOut=0,Answer} d_waitstatus; 
    81  
    82 public: 
    8382  //! Constructor 
    8483  /** Constructor with a small default stacksize. If any of your threads exceeds this stack, your application will crash.  
     
    9291 
    9392  typedef void tfunc_t(void *); //!< type of the pointer that starts a thread  
    94   int waitEvent(const EventKey &key, EventVal *val=0, unsigned int timeout=0); 
     93  int waitEvent(EventKey &key, EventVal *val=0, unsigned int timeout=0); 
    9594  void yield(); 
    9695  int sendEvent(const EventKey& key, const EventVal* val=0); 
     
    104103private: 
    105104  static void threadWrapper(MTasker *self, tfunc_t *tf, int tid, void* val); 
     105  EventKey d_eventkey;   // for waitEvent, contains exact key it was awoken for 
    106106}; 
    107107#include "mtasker.cc"