NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 2482


Ignore:
Timestamp:
Mar 20, 2007, 6:34:45 PM (11 years ago)
Author:
hiwi-laier
Message:

Flags for draft 13, wrapped in QOS_NSLP_13. No functional change outside of that.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qos-nslp/branches/laier-update/include/nslp_pdu.h

    r1504 r2482  
    5555
    5656 
     57#ifdef QOS_NSLP_13
     58                /* Namespace these at least a bit */
     59                /* generic flags (16 bit) */
     60                #define GEN_FLAG_SCOPING                (1<<0)
     61                #define GEN_FLAG_PROXY                  (1<<1)
     62                #define GEN_FLAG_ACKNOWLEDGE    (1<<2)
     63
     64                /* RESERVE specific flags (8 bit) */
     65                #define RESV_FLAG_REPLACE               (1<<0)
     66                #define RESV_FLAG_TEAR                  (1<<1)
     67                #define RESV_FLAG_REQ_REDUCED_REFRESH   (1<<2)          // ugly name
     68                #define RESV_FLAG_BREAK                 (1<<3)
     69
     70                /* QUERY specific flags (8 bit) */
     71                #define QUERY_FLAG_RESERVE_INIT (1<<0)
     72                #define QUERY_FLAG_BREAK                (1<<1)
     73
     74                /* RESPONSE specific flags (8bit) */
     75                #define RESP_FLAG_BREAK                 (1<<0)
     76
     77/* Note: Looking at this, it seems stupid not to have the BREAK flag in GENERIC */
     78#else
    5779        // specific flags for RESERVE message
    5880        #define REPLACE_FLAG             0x01   // 0000 0001
     
    6587        // generic flags
    6688        #define SCOPING_FLAG             0x0001   // 0000 0000 0000 0001
    67  
     89#endif /* QOS_NSLP_13 */
     90
    6891        /// max PDU size
    6992        static const uint32 max_size;
     
    111134        /// set RESERVE_INIT flag
    112135        void set_reserve_init_flag();
     136#ifdef QOS_NSLP_13
     137                void set_proxy_flag();
     138                void set_req_reduced_refresh_flag();
     139                void set_break_flag(); // XXX: should this be namespaced?
     140#endif
     141
    113142
    114143        /// is REPLACE flag set?
     
    122151        /// is RESERVE_INIT flag set?
    123152        bool is_reserve_init_flag();
    124 
     153#ifdef QOS_NSLP_13
     154                bool is_proxy_flag();
     155                bool is_req_reduced_refresh_flag();
     156                bool is_break_flag();
     157#endif
    125158        // @{
    126159        rsn* get_rsn() const;
     
    195228        bool set_rp_timer;
    196229        bool originator;
     230
     231#ifdef QOS_NSLP_13
     232        bool break_flag_set;    // XXX: This is a hack!
     233#endif
    197234       
    198235        void print_object(uint32 pos, ostream& os, uint32 level, const uint32 indent, bool& o, const char* name = NULL) const;
     
    331368/** @set flags of the NSLP PDU. */
    332369
    333 inline void nslp_pdu::set_generic_flags(uint16 f) {
    334     generic_flags &= 0x0000;
    335     generic_flags |= f; }
    336 
    337 inline void nslp_pdu::set_specific_flags(uint8 f) {
    338     specific_flags &= 0x00;
    339     specific_flags |= f; }
     370inline void nslp_pdu::set_generic_flags(uint16 f) { generic_flags = f; }
     371
     372inline void nslp_pdu::set_specific_flags(uint8 f) { specific_flags = f; }
    340373
    341374/// set REPLACE flag
    342375inline
    343376void
    344 nslp_pdu::set_replace_flag() {specific_flags |= REPLACE_FLAG; }
     377nslp_pdu::set_replace_flag() {
     378#ifdef QOS_NSLP_13
     379        specific_flags |= RESV_FLAG_REPLACE;
     380#else
     381        specific_flags |= REPLACE_FLAG;
     382#endif
     383}
    345384/// set ACKNOWLEDGE flag
    346385inline
    347386void
    348 nslp_pdu::set_acknowledge_flag() {specific_flags |= ACKNOWLEDGE_FLAG; }
     387nslp_pdu::set_acknowledge_flag() {
     388#ifdef QOS_NSLP_13
     389        generic_flags |= GEN_FLAG_ACKNOWLEDGE;
     390#else
     391        specific_flags |= ACKNOWLEDGE_FLAG;
     392#endif
     393}
    349394/// set SCOPING flag
    350395inline
    351396void
    352 nslp_pdu::set_scoping_flag() {generic_flags |= SCOPING_FLAG; }
     397nslp_pdu::set_scoping_flag() {
     398#ifdef QOS_NSLP_13
     399        generic_flags |= GEN_FLAG_SCOPING;
     400#else
     401        generic_flags |= SCOPING_FLAG;
     402#endif
     403}
    353404/// set TEAR flag
    354405inline
    355406void
    356 nslp_pdu::set_tear_flag() {specific_flags |= TEAR_FLAG; }
     407nslp_pdu::set_tear_flag() {
     408#ifdef QOS_NSLP_13
     409        specific_flags |= RESV_FLAG_TEAR;
     410#else
     411        specific_flags |= TEAR_FLAG;
     412#endif
     413}
    357414/// set RESERVE_INIT flag
    358 inline void nslp_pdu::set_reserve_init_flag() {specific_flags |= RESERVE_INIT_FLAG; }
    359 
     415inline void nslp_pdu::set_reserve_init_flag() {
     416#ifdef QOS_NSLP_13
     417        specific_flags |= QUERY_FLAG_RESERVE_INIT;
     418#else
     419        specific_flags |= RESERVE_INIT_FLAG;
     420#endif
     421}
     422
     423#ifdef QOS_NSLP_13
     424inline void nslp_pdu::set_proxy_flag() { generic_flags |= GEN_FLAG_PROXY; }
     425inline void nslp_pdu::set_req_reduced_refresh_flag() {
     426        specific_flags |= RESV_FLAG_REQ_REDUCED_REFRESH;
     427}
     428inline void nslp_pdu::set_break_flag() {
     429        break_flag_set = true;
     430}
     431#endif
    360432
    361433/// is REPLACE flag set?
    362434inline
    363 bool nslp_pdu::is_replace_flag() {return (specific_flags & REPLACE_FLAG);}
     435bool nslp_pdu::is_replace_flag() {
     436#ifdef QOS_NSLP_13
     437        return (specific_flags & RESV_FLAG_REPLACE);
     438#else
     439        return (specific_flags & REPLACE_FLAG);
     440#endif
     441}
    364442
    365443/// is ACKNOWLEDGE flag set?
    366444inline
    367 bool nslp_pdu::is_acknowledge_flag()  {return (specific_flags & ACKNOWLEDGE_FLAG);}
     445bool nslp_pdu::is_acknowledge_flag()  {
     446#ifdef QOS_NSLP_13
     447        return (generic_flags & GEN_FLAG_ACKNOWLEDGE);
     448#else
     449        return (specific_flags & ACKNOWLEDGE_FLAG);
     450#endif
     451}
    368452
    369453/// is SCOPING flag set?
    370454inline
    371 bool nslp_pdu::is_scoping_flag()  {return (generic_flags & SCOPING_FLAG);}
     455bool nslp_pdu::is_scoping_flag()  {
     456#ifdef QOS_NSLP_13
     457        return (generic_flags & GEN_FLAG_SCOPING);
     458#else
     459        return (generic_flags & SCOPING_FLAG);
     460#endif
     461}
    372462
    373463/// is TEAR flag set?
    374464inline
    375 bool nslp_pdu::is_tear_flag()  {return (specific_flags & TEAR_FLAG);}
     465bool nslp_pdu::is_tear_flag()  {
     466#ifdef QOS_NSLP_13
     467        return (specific_flags & RESV_FLAG_TEAR);
     468#else
     469        return (specific_flags & TEAR_FLAG);
     470#endif
     471}
    376472
    377473/// is RESERVE_INIT flag set?
    378 inline bool nslp_pdu::is_reserve_init_flag()  {return (specific_flags & RESERVE_INIT_FLAG);}
    379 
     474inline bool nslp_pdu::is_reserve_init_flag()  {
     475#ifdef QOS_NSLP_13
     476        return (specific_flags & QUERY_FLAG_RESERVE_INIT);
     477#else
     478        return (specific_flags & RESERVE_INIT_FLAG);
     479#endif
     480}
     481
     482#ifdef QOS_NSLP_13
     483inline bool nslp_pdu::is_proxy_flag() { return (generic_flags & GEN_FLAG_PROXY); }
     484inline bool nslp_pdu::is_req_reduced_refresh_flag() {
     485        return (specific_flags & RESV_FLAG_REQ_REDUCED_REFRESH);
     486}
     487inline bool nslp_pdu::is_break_flag() { return break_flag_set; }
     488#endif
    380489
    381490/** true if this is a RESERVE PDU. */
Note: See TracChangeset for help on using the changeset viewer.