ESP8266 Developer Zone The Official ESP8266 Forum 2015-10-30T11:05:15+08:00 https://bbs.espressif.com:443/feed.php?f=66&t=702 2015-10-30T11:05:15+08:00 2015-10-30T11:05:15+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=4374#p4374 <![CDATA[Re: struct espconn and reverse field]]>
Sorry that we did not modify the "reverse" to be "reserve", because some developers may already use it.

But we are working on RTOS espconn now, it will be fixed in RTOS espconn. It is reserved for user data.

Code:

struct espconn {
    enum espconn_type type;     /**< type of the espconn (TCP or UDP)   */
    enum espconn_state state;   /**< current state of the espconn       */
    union {
        esp_tcp *tcp;
        esp_udp *udp;
    } proto;
    espconn_recv_callback recv_callback;    /**< data received callback */
    espconn_sent_callback sent_callback;    /**< data sent callback     */
    uint8 link_cnt;         /**< link count             */
    void *reserve;          /**< reserved for user data */
};

Statistics: Posted by ESP_Faye — Fri Oct 30, 2015 11:05 am


]]>
2015-10-28T08:46:27+08:00 2015-10-28T08:46:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=4323#p4323 <![CDATA[Re: struct espconn and reverse field]]> Statistics: Posted by kolban — Wed Oct 28, 2015 8:46 am


]]>
2015-07-09T11:51:52+08:00 2015-07-09T11:51:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=2583#p2583 <![CDATA[Re: struct espconn and reverse field]]>
My personal vote would be one of:

void *data;

or

void *userData;

Statistics: Posted by kolban — Thu Jul 09, 2015 11:51 am


]]>
2015-07-09T07:07:50+08:00 2015-07-09T07:07:50+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=2579#p2579 <![CDATA[Re: struct espconn and reverse field]]>

If you are going to rename the field, please, please do not name it to "reserved".

In english it may mean "pre-allocate in advance" but in any kind of code it means - reserved - do not touch, do not use . Most common case is reserved for future use. Other variants include but not limited to - get proper struct padding, get specific struct size, get specific struct members alignment.

The right way to name a callback data is:
void *data; // user callback data
or
void *callback_data; // if you want to be more verbose
or
void *priv; // which means it's private to the user, i.e. the sdk would not touch it

TIA!

Statistics: Posted by zaxl — Thu Jul 09, 2015 7:07 am


]]>
2015-07-07T22:24:15+08:00 2015-07-07T22:24:15+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=2553#p2553 <![CDATA[Re: struct espconn and reverse field]]> Statistics: Posted by kolban — Tue Jul 07, 2015 10:24 pm


]]>
2015-07-07T16:18:17+08:00 2015-07-07T16:18:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=2545#p2545 <![CDATA[Re: struct espconn and reverse field]]>
Thanks for your advice !

So sorry for our poor English .. :oops:

We will revise them in next SDK !

Statistics: Posted by ESP_Faye — Tue Jul 07, 2015 4:18 pm


]]>
2015-07-07T11:04:00+08:00 2015-07-07T11:04:00+08:00 https://bbs.espressif.com:443/viewtopic.php?t=702&p=2532#p2532 <![CDATA[struct espconn and reverse field]]>
// reserved for customer use

I am thinking that we have a typo in the field name and instead of "reverse" (which in English means "to go backwards") it should be "reserved" (which in English means to "pre-allocate in advance").

Statistics: Posted by kolban — Tue Jul 07, 2015 11:04 am


]]>