Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
core
tarantool
Commits
7cfc7628
Commit
7cfc7628
authored
9 years ago
by
Roman Tsisyk
Browse files
Options
Downloads
Patches
Plain Diff
arm: sanitize session.h header
parent
b55350c0
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/box/session.h
+59
-50
59 additions, 50 deletions
src/box/session.h
with
59 additions
and
50 deletions
src/box/session.h
+
59
−
50
View file @
7cfc7628
...
...
@@ -36,6 +36,16 @@
#include
"fiber.h"
#include
"user.h"
#if defined(__cplusplus)
extern
"C"
{
#endif
/* defined(__cplusplus) */
void
session_init
();
void
session_free
();
enum
{
SESSION_SEED_SIZE
=
32
,
SESSION_DELIM_SIZE
=
16
};
/**
...
...
@@ -76,6 +86,53 @@ struct session {
struct
trigger
fiber_on_stop
;
};
/**
* Find a session by id.
*/
struct
session
*
session_find
(
uint32_t
sid
);
/** Global on-connect triggers. */
extern
struct
rlist
session_on_connect
;
extern
struct
rlist
session_on_auth
;
static
inline
void
fiber_set_user
(
struct
fiber
*
fiber
,
struct
credentials
*
cr
)
{
fiber_set_key
(
fiber
,
FIBER_KEY_USER
,
cr
);
}
static
inline
void
fiber_set_session
(
struct
fiber
*
fiber
,
struct
session
*
session
)
{
fiber_set_key
(
fiber
,
FIBER_KEY_SESSION
,
session
);
}
static
inline
void
credentials_init
(
struct
credentials
*
cr
,
struct
user
*
user
)
{
cr
->
auth_token
=
user
->
auth_token
;
cr
->
universal_access
=
universe
.
access
[
cr
->
auth_token
].
effective
;
cr
->
uid
=
user
->
uid
;
}
static
inline
void
credentials_copy
(
struct
credentials
*
dst
,
struct
credentials
*
src
)
{
*
dst
=
*
src
;
}
/*
* For use in local hot standby, which runs directly
* from ev watchers (without current fiber), but needs
* to execute transactions.
*/
extern
struct
credentials
admin_credentials
;
#if defined(__cplusplus)
}
/* extern "C" */
/**
* Create a session.
* Invokes a Lua trigger box.session.on_connect if it is
...
...
@@ -102,15 +159,6 @@ session_create(int fd, uint64_t cookie);
void
session_destroy
(
struct
session
*
);
/**
* Find a session by id.
*/
struct
session
*
session_find
(
uint32_t
sid
);
/** Global on-connect triggers. */
extern
struct
rlist
session_on_connect
;
/** Run on-connect triggers */
void
session_run_on_connect_triggers
(
struct
session
*
session
);
...
...
@@ -122,32 +170,12 @@ extern struct rlist session_on_disconnect;
void
session_run_on_disconnect_triggers
(
struct
session
*
session
);
extern
struct
rlist
session_on_auth
;
void
session_run_on_auth_triggers
(
const
char
*
user_name
);
void
session_init
();
void
session_free
();
void
session_storage_cleanup
(
int
sid
);
static
inline
void
fiber_set_user
(
struct
fiber
*
fiber
,
struct
credentials
*
cr
)
{
fiber_set_key
(
fiber
,
FIBER_KEY_USER
,
cr
);
}
static
inline
void
fiber_set_session
(
struct
fiber
*
fiber
,
struct
session
*
session
)
{
fiber_set_key
(
fiber
,
FIBER_KEY_SESSION
,
session
);
}
/**
* Create a new session on demand, and set fiber on_stop
* trigger to destroy it when this fiber ends.
...
...
@@ -155,13 +183,6 @@ fiber_set_session(struct fiber *fiber, struct session *session)
struct
session
*
session_create_on_demand
();
/*
* For use in local hot standby, which runs directly
* from ev watchers (without current fiber), but needs
* to execute transactions.
*/
extern
struct
credentials
admin_credentials
;
/*
* When creating a new fiber, the database (box)
* may not be initialized yet. When later on
...
...
@@ -200,20 +221,6 @@ current_user()
return
u
;
}
static
inline
void
credentials_init
(
struct
credentials
*
cr
,
struct
user
*
user
)
{
cr
->
auth_token
=
user
->
auth_token
;
cr
->
universal_access
=
universe
.
access
[
cr
->
auth_token
].
effective
;
cr
->
uid
=
user
->
uid
;
}
static
inline
void
credentials_copy
(
struct
credentials
*
dst
,
struct
credentials
*
src
)
{
*
dst
=
*
src
;
}
static
inline
void
access_check_universe
(
uint8_t
access
)
{
...
...
@@ -226,4 +233,6 @@ access_check_universe(uint8_t access)
}
}
#endif
/* defined(__cplusplus) */
#endif
/* INCLUDES_TARANTOOL_SESSION_H */
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