2015-10-27 00:20:44 +02:00
.TH SXHUB_SET_AUTHCHECK 3 "20 July 2015" "SXMP" "SXMP Library Manual"
2015-08-04 19:05:14 +03:00
.SH NAME
2015-10-27 00:20:44 +02:00
sxhub_set_authcheck \- Set callback for the connection links based on the connections set, called to validate user name and password of the peer.
2015-08-04 19:05:14 +03:00
.br
.SH SYNOPSIS
2015-10-27 00:20:44 +02:00
.B #include <sxmp/sxmp.h>
2015-08-04 19:05:14 +03:00
.sp
2015-10-27 00:20:44 +02:00
#define sxhub_set_authcheck(c, f)
2015-08-04 19:05:14 +03:00
.br
.sp
.SH DESCRIPTION
This macro should be used if you want to setup callback function fired while connection link initiating, and depending on returning value will establish link or destroy it.
.br
This macro will set on
.B c
connections link set callback
.B f
which is a function pointer of the type:
.br
.sp
2015-11-11 16:01:18 +02:00
.B typedef int (*authcheck_t)(sxlink_t *);
2015-08-04 19:05:14 +03:00
.br
.sp
It will pass a pointer to the connection link initiating now. Link isn't set fully at this moment and doesn't pass any messages and don't works with channel's operations. To pass initiation to the next stage this function should return
2015-11-11 16:01:18 +02:00
.B SXE_SUCCESS.
2015-08-04 19:05:14 +03:00
In fail case other code error should be returned. It's a good practice to return
2015-11-11 16:01:18 +02:00
.B SXE_EPERM
2015-08-04 19:05:14 +03:00
if username and password mismatch.
.SH RETURN VALUE
None.
.SH ERRORS
None.
.SH BUGS
None known yet.
.SH EXAMPLE
This example shows the code prototype for the simple username and password check:
.RS
.nf
.if t .ft CW
2015-11-11 16:01:18 +02:00
int logincheck(sxlink_t *co)
2015-08-04 19:05:14 +03:00
{
2015-11-11 16:01:18 +02:00
sxsession_ctx_t *ctx = sxlink_getpctx(co);
2015-08-04 19:05:14 +03:00
char *login = ctx->login;
char *password = ctx->password;
/* do checks ... */
/* your fail case */return SNE_EPERM;
2015-11-11 16:01:18 +02:00
return SXE_SUCCESS; /* all is fine */
2015-08-04 19:05:14 +03:00
}
.SH APPLICATION USAGE
This function should be used on the master service, it will not be called on the client application anyway.
.SH RATIONALE
None.
.SH SEE ALSO
2015-10-27 00:20:44 +02:00
.BI sxhub_set_priv(3)
2015-08-04 19:05:14 +03:00
,
2015-10-27 00:20:44 +02:00
.BI sxhub_get_priv(3)
2015-08-04 19:05:14 +03:00
,
2015-10-27 00:20:44 +02:00
.BI sxhub_set_ondestroy(3)
2015-08-04 19:05:14 +03:00
,
2015-10-27 00:20:44 +02:00
.BI sxhub_set_sslvalidate(3)
2015-08-04 19:05:14 +03:00
,
2015-11-11 16:01:18 +02:00
.BI sxlink_getpctx(3)
2015-08-04 19:05:14 +03:00
,
2015-11-11 16:01:18 +02:00
.BI sxlink_getpriv(3)
2015-08-04 19:05:14 +03:00
,
2015-11-11 16:01:18 +02:00
.BI sxlink_setpriv(3)
2015-08-04 19:05:14 +03:00
.SH COPYRIGHT
2015-12-29 22:42:52 +02:00
This software licensed under GNU LGPL v3. See COPYING for further details.
2015-08-04 19:05:14 +03:00
.br
(c) Askele Group 2013-2015 <http://askele.com>
.SH AUTHOR
Alexander Vdolainen (vdo@askele.com)