Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
be1b2312
Commit
be1b2312
authored
12 years ago
by
meiyangbigswitch
Browse files
Options
Downloads
Patches
Plain Diff
APPCookie change to accomodate REWRITE FLAGS
parent
fa5de47f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/core/util/AppCookie.java
+46
-1
46 additions, 1 deletion
...in/java/net/floodlightcontroller/core/util/AppCookie.java
with
46 additions
and
1 deletion
src/main/java/net/floodlightcontroller/core/util/AppCookie.java
+
46
−
1
View file @
be1b2312
...
@@ -27,10 +27,17 @@ package net.floodlightcontroller.core.util;
...
@@ -27,10 +27,17 @@ package net.floodlightcontroller.core.util;
public
class
AppCookie
{
public
class
AppCookie
{
static
final
int
APP_ID_BITS
=
12
;
static
final
int
APP_ID_BITS
=
12
;
static
final
int
APP_ID_SHIFT
=
(
64
-
APP_ID_BITS
);
static
final
int
APP_ID_SHIFT
=
(
64
-
APP_ID_BITS
);
// we have bits 13-31 unused here ... that's ok!
/**the following bit will be set accordingly if the field is rewritten by application. e.g. VRS or floating IP */
static
final
int
SRC_MAC_REWRITE_BIT
=
13
;
static
final
int
DEST_MAC_REWRITE_BIT
=
14
;
static
final
int
SRC_IP_REWRITE_BIT
=
15
;
static
final
int
DEST_IP_REWRITE_BIT
=
16
;
// we have bits 17-31 unused here ... that's ok!
static
final
int
USER_BITS
=
32
;
static
final
int
USER_BITS
=
32
;
static
final
int
USER_SHIFT
=
0
;
static
final
int
USER_SHIFT
=
0
;
static
final
long
REWRITE_MASK
=
0x000f000000000000
L
;
/**
/**
* Encapsulate an application ID and a user block of stuff into a cookie
* Encapsulate an application ID and a user block of stuff into a cookie
...
@@ -51,4 +58,42 @@ public class AppCookie {
...
@@ -51,4 +58,42 @@ public class AppCookie {
static
public
int
extractUser
(
long
cookie
)
{
static
public
int
extractUser
(
long
cookie
)
{
return
(
int
)((
cookie
>>
USER_SHIFT
)
&
((
1L
<<
USER_BITS
)
-
1
));
return
(
int
)((
cookie
>>
USER_SHIFT
)
&
((
1L
<<
USER_BITS
)
-
1
));
}
}
static
public
boolean
isRewriteFlagSet
(
long
cookie
)
{
if
((
cookie
&
REWRITE_MASK
)
!=
0L
)
return
true
;
return
false
;
}
static
public
boolean
isSrcMacRewriteFlagSet
(
long
cookie
)
{
if
((
cookie
&
(
1L
<<
(
64
-
SRC_MAC_REWRITE_BIT
)))
!=
0L
)
return
true
;
return
false
;
}
static
public
boolean
isDestMacRewriteFlagSet
(
long
cookie
)
{
if
((
cookie
&
(
1L
<<
(
64
-
DEST_MAC_REWRITE_BIT
)))
!=
0L
)
return
true
;
return
false
;
}
static
public
boolean
isSrcIpRewriteFlagSet
(
long
cookie
)
{
if
((
cookie
&
(
1L
<<
(
64
-
SRC_IP_REWRITE_BIT
)))
!=
0L
)
return
true
;
return
false
;
}
static
public
boolean
isDestIpRewriteFlagSet
(
long
cookie
)
{
if
((
cookie
&
(
1L
<<
(
64
-
DEST_IP_REWRITE_BIT
)))
!=
0L
)
return
true
;
return
false
;
}
static
public
long
setSrcMacRewriteFlag
(
long
cookie
)
{
return
cookie
|
(
1L
<<
(
64
-
SRC_MAC_REWRITE_BIT
));
}
static
public
long
setDestMacRewriteFlag
(
long
cookie
)
{
return
cookie
|
(
1L
<<
(
64
-
DEST_MAC_REWRITE_BIT
));
}
static
public
long
setSrcIpRewriteFlag
(
long
cookie
)
{
return
cookie
|
(
1L
<<
(
64
-
SRC_IP_REWRITE_BIT
));
}
static
public
long
setDestIpRewriteFlag
(
long
cookie
)
{
return
cookie
|
(
1L
<<
(
64
-
DEST_IP_REWRITE_BIT
));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment