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
.Bc
connections link set callback
.Bf
which is a function pointer of the type:
.br
.sp
.Btypedefint(*authcheck_t)(conn_t*);
.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
.BSNE_SUCCESS.
In fail case other code error should be returned. It's a good practice to return
.BSNE_EPERM
if username and password mismatch.
.SHRETURNVALUE
None.
.SHERRORS
None.
.SHBUGS
None known yet.
.SHEXAMPLE
This example shows the code prototype for the simple username and password check:
.RS
.nf
.ift.ftCW
int logincheck(conn_t *co)
{
perm_ctx_t *ctx = connection_getpctx(co);
char *login = ctx->login;
char *password = ctx->password;
/* do checks ... */
/* your fail case */return SNE_EPERM;
return SNE_SUCCESS; /* all is fine */
}
.SHAPPLICATIONUSAGE
This function should be used on the master service, it will not be called on the client application anyway.