~eday/drizzle/eday-dev

« back to all changes in this revision

Viewing changes to plugin/drizzle_protocol/oldlibdrizzle.cc

  • Committer: Eric Day
  • Date: 2010-01-07 20:02:38 UTC
  • mfrom: (971.3.291 staging)
  • Revision ID: eday@oddments.org-20100107200238-uqw8v6kv9pl7nny5
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 */
19
19
 
20
 
#include <drizzled/server_includes.h>
 
20
#include "config.h"
21
21
#include <drizzled/gettext.h>
22
22
#include <drizzled/error.h>
 
23
#include "drizzled/my_error.h"
23
24
#include <drizzled/query_id.h>
24
25
#include <drizzled/sql_state.h>
25
26
#include <drizzled/session.h>
 
27
#include "drizzled/internal/my_sys.h"
 
28
#include "drizzled/internal/m_string.h"
26
29
#include <algorithm>
27
30
 
28
31
#include "pack.h"
35
38
 
36
39
#define PROTOCOL_VERSION 10
37
40
 
 
41
extern uint32_t global_thread_id;
 
42
 
 
43
static const uint32_t DRIZZLE_TCP_PORT= 4427;
38
44
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
39
45
static uint32_t port;
40
46
static uint32_t connect_timeout;
51
57
 
52
58
in_port_t ListenDrizzleProtocol::getPort(void) const
53
59
{
54
 
  struct servent *serv_ptr;
55
60
  char *env;
56
61
 
57
62
  if (port == 0)
58
63
  {
59
64
    port= DRIZZLE_TCP_PORT;
60
65
 
61
 
    if (DRIZZLE_TCP_PORT_DEFAULT == 0)
62
 
    {
63
 
      if ((serv_ptr= getservbyname("drizzle", "tcp")))
64
 
        port= ntohs((u_short) serv_ptr->s_port);
65
 
    }
66
 
 
67
66
    if ((env = getenv("DRIZZLE_TCP_PORT")))
68
67
      port= (uint32_t) atoi(env);
69
68
 
824
823
}
825
824
 
826
825
static DRIZZLE_SYSVAR_UINT(port, port, PLUGIN_VAR_RQCMDARG,
827
 
                           N_("Port number to use for connection or 0 for default to, in order of "
828
 
                              "preference, drizzle.cnf, $DRIZZLE_TCP_PORT, built-in default ("
829
 
                              STRINGIFY_ARG(DRIZZLE_TCP_PORT) ")."),
 
826
                           N_("Port number to use for connection or 0 for "
 
827
                              "default to, in order of "
 
828
                              "preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
 
829
                              "built-in default (4427)."),
830
830
                           NULL, NULL, 0, 0, 65535, 0);
831
831
static DRIZZLE_SYSVAR_UINT(connect_timeout, connect_timeout,
832
832
                           PLUGIN_VAR_RQCMDARG, N_("Connect Timeout."),
856
856
 
857
857
DRIZZLE_DECLARE_PLUGIN
858
858
{
 
859
  DRIZZLE_VERSION_ID,
859
860
  "drizzle_protocol",
860
861
  "0.1",
861
862
  "Eric Day",