Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] More triggers to plugin or external script.

Ah sorry,

the original mosquitto code is like this:
typedef int (*FUNC_auth_plugin_version)(void);
typedef int (*FUNC_auth_plugin_init)(void **, struct mosquitto_auth_opt *, int);
typedef int (*FUNC_auth_plugin_cleanup)(void *, struct mosquitto_auth_opt *, int);
typedef int (*FUNC_auth_plugin_security_init)(void *, struct mosquitto_auth_opt *, int, bool);
typedef int (*FUNC_auth_plugin_security_cleanup)(void *, struct mosquitto_auth_opt *, int, bool);
typedef int (*FUNC_auth_plugin_acl_check)(void *, const char *, const char *, const char *, int);
typedef int (*FUNC_auth_plugin_unpwd_check)(void *, const char *, const char *);
typedef int (*FUNC_auth_plugin_psk_key_get)(void *, const char *, const char *, char *, int);
But I was looking at my code, which I've added more hooks
You will have to implement them by adding required code like:

typedef int (*FUNC_auth_plugin_version)(void);
typedef int (*FUNC_auth_plugin_init)(void **, struct mosquitto_auth_opt *, int);
typedef int (*FUNC_auth_plugin_cleanup)(void *, struct mosquitto_auth_opt *, int);
typedef int (*FUNC_auth_plugin_security_init)(void *, struct mosquitto_auth_opt *, int, bool);
typedef int (*FUNC_auth_plugin_security_cleanup)(void *, struct mosquitto_auth_opt *, int, bool);
typedef int (*FUNC_auth_plugin_acl_check)(void *, const char *, const char *, const char *, int);
typedef int (*FUNC_auth_plugin_unpwd_check)(void *, const char *, const char *, const char *);
typedef int (*FUNC_auth_plugin_psk_key_get)(void *, const char *, const char *, char *, int);
typedef int (*FUNC_auth_plugin_disconnect)(void *, const char *, int);
typedef int (*FUNC_auth_plugin_log)(void *, const char *);
typedef int (*FUNC_auth_plugin_subscribe)(void *, const char *);
typedef int (*FUNC_auth_plugin_unsubscribe)(void *, const char *);

The additions are not just here,
There are more code to add to implement those hooks,
Sorry for the confusion.

But I don't think this will solve the problem you described,
If mobile devices where not able to send last message, that means the message's never reached the broker, so how do you plan to make the broker know about this?

Regards
Alexandre















On Mon, Sep 21, 2015 at 9:12 AM, 변동호 <cpascal@xxxxxxxxx> wrote:

 

Thank you very much, Alexandre Zia.

 

But I cannot find the FUNC_auth_plugin_disconnect in src/security.c

- http://git.eclipse.org/c/mosquitto/org.eclipse.mosquitto.git/tree/src/security.c?h=master

http://git.eclipse.org/c/mosquitto/org.eclipse.mosquitto.git/tree/src/security.c?h=develop

 

  And, using "(dis)connect" topic is good idea, but user-applications on mobile environment can be network-unconnectable suddenly. So user-application cannot send the last message, so the last message should be determine by MQTT broker.

Then I think disconnect plugin is needed still.

 

  Where can I look for the FUNC_auth_plugin_disconnect?

 

Many thanks in advance.

 

P.S. Please apology me that I'm not good in English well, so I could mis-understand or saying using wrong wording.

 

-----Original Message-----
From: "Alexandre Zia"<alexandre.zia@xxxxxxxxxx>
To: "변동호"<cpascal@xxxxxxxxx>; "General development discussions for the mosquitto project"<mosquitto-dev@xxxxxxxxxxx>;
Cc:
Sent: 2015-09-17 (목) 12:31:03
Subject: Re: [mosquitto-dev] More triggers to plugin or external script.
 

Hi cpascal
 
There is a hook for disconnection,
look for :  FUNC_auth_plugin_disconnect  in src/security.c 
You can create a plugin and implement this hook to do what you want.
 
However, there is an easier way to acomplish what you want, just set last will message for each user connecting to you application and make it publish in a determined topic 
Then create an application to subscribe to this topic and you will receive a disconnect message from the broker whenever a user disconnects, if you put the username in the paylod you can easily identify the user.
 
Regards 
Alexandre Zia 


 

On Thu, Sep 17, 2015 at 12:05 AM, 변동호 <cpascal@xxxxxxxxx> wrote:

 

Hello,

 

  I'm trying to make general-purpose channel-chatting server for mobile devices, using mosquitto.

 

- Max. user limit: 100 per channel 

- Users have own nicknames.

- Userlist visible for each channel.

 

  I'm using mosquitto brokers as front-end servers, and using php REST services for userlist(redis) in the channels.

Also, I've made a client using C/C++..  Everything works well except I cannot determine the users is disconncted by network unavailablity. I want delete the user in the userlist..

 

  I think it's very easy if mosquitto supports a trigger(auth_plugin?) on disconnect. :)

 

Many thanks in advance.


_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev



--

Alexandre Zia
Security
+55 19 3518 5500
+55 19 98153 4618
skype: zia.movile




--

Alexandre Zia
Security
+55 19 3518 5500
+55 19 98153 4618
skype: zia.movile


Back to the top