Home | History | Annotate | Download | only in examples

Lines Matching refs:Session

65 #define COOKIE_NAME "session"
69 * State we keep for each user/session/browser.
71 struct Session
76 struct Session *next;
79 * Unique ID for this session.
85 * currently using this session.
90 * Time when this session was last active.
114 * Associated session.
116 struct Session *session;
137 static struct Session *sessions;
143 * Return the session handle for this connection, or
146 static struct Session *
149 struct Session *ret;
157 /* find existing session */
171 /* create fresh session */
172 ret = calloc (1, sizeof (struct Session));
178 /* not a super-secure way to generate a random session ID,
200 * @param session session information
206 struct Session *session,
238 * Add header to response to set a session cookie.
240 * @param session session to use
244 add_session_cookie (struct Session *session,
252 session->sid);
259 "Failed to set session cookie header!\n");
270 * @param session session handle
276 struct Session *session,
289 add_session_cookie (session, response);
306 * @param session session handle
312 struct Session *session,
319 reply = malloc (strlen (MAIN_PAGE) + strlen (session->value_1) + 1);
323 strlen (MAIN_PAGE) + strlen (session->value_1) + 1,
325 session->value_1);
332 add_session_cookie (session, response);
349 * @param session session handle
355 struct Session *session,
362 reply = malloc (strlen (SECOND_PAGE) + strlen (session->value_1) + strlen (session->value_2) + 1);
366 strlen (SECOND_PAGE) + strlen (session->value_1) + strlen (session->value_2) + 1,
368 session->value_1,
369 session->value_2);
376 add_session_cookie (session, response);
393 * @param session session handle
399 struct Session *session,
465 struct Session *session = request->session;
470 "Session `%s' submitted `%s', `%s'\n",
471 session->sid,
472 session->value_1,
473 session->value_2);
478 if (size + off >= sizeof(session->value_1))
479 size = sizeof (session->value_1) - off - 1;
480 memcpy (&session->value_1[off],
483 session->value_1[size+off] = '\0';
488 if (size + off >= sizeof(session->value_2))
489 size = sizeof (session->value_2) - off - 1;
490 memcpy (&session->value_2[off],
493 session->value_2[size+off] = '\0';
548 struct Session *session;
575 if (NULL == request->session)
577 request->session = get_session (connection);
578 if (NULL == request->session)
580 fprintf (stderr, "Failed to setup session for `%s'\n",
585 session = request->session;
586 session->start = time (NULL);
616 session, connection);
636 * Decrements session reference counter.
640 * @param con_cls session handle
653 if (NULL != request->session)
654 request->session->rc--;
668 struct Session *pos;
669 struct Session *prev;
670 struct Session *next;