Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
a7f6210d
Commit
a7f6210d
authored
Nov 12, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The PacketReceive/PacketSend routines aren't used anymore.
parent
215772ae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
228 deletions
+3
-228
src/backend/libpq/Makefile
src/backend/libpq/Makefile
+2
-2
src/backend/libpq/pqpacket.c
src/backend/libpq/pqpacket.c
+0
-215
src/include/libpq/libpq-be.h
src/include/libpq/libpq-be.h
+1
-11
No files found.
src/backend/libpq/Makefile
View file @
a7f6210d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# Makefile for libpq subsystem (backend half of libpq interface)
# Makefile for libpq subsystem (backend half of libpq interface)
#
#
# IDENTIFICATION
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.2
6 2001/11/12 01:42:03 momjian
Exp $
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.2
7 2001/11/12 04:19:15 tgl
Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
...
@@ -16,7 +16,7 @@ include $(top_builddir)/src/Makefile.global
...
@@ -16,7 +16,7 @@ include $(top_builddir)/src/Makefile.global
OBJS
=
be-fsstubs.o
\
OBJS
=
be-fsstubs.o
\
auth.o crypt.o hba.o md5.o password.o
\
auth.o crypt.o hba.o md5.o password.o
\
pqcomm.o pqformat.o pq
packet.o pq
signal.o util.o
pqcomm.o pqformat.o pqsignal.o util.o
all
:
check_md5 SUBSYS.o
all
:
check_md5 SUBSYS.o
...
...
src/backend/libpq/pqpacket.c
deleted
100644 → 0
View file @
215772ae
/*-------------------------------------------------------------------------
*
* pqpacket.c
* routines for reading and writing data packets sent/received by
* POSTGRES clients and servers
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.30 2001/11/05 17:46:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <errno.h>
#include "postgres.h"
#include "libpq/libpq.h"
/*
* Set up a packet read for the postmaster event loop.
*/
void
PacketReceiveSetup
(
Packet
*
pkt
,
PacketDoneProc
iodone
,
void
*
arg
)
{
pkt
->
nrtodo
=
sizeof
(
pkt
->
len
);
pkt
->
ptr
=
(
char
*
)
&
pkt
->
len
;
pkt
->
iodone
=
iodone
;
pkt
->
arg
=
arg
;
pkt
->
state
=
ReadingPacketLength
;
/* Clear the destination. */
MemSet
(
&
pkt
->
pkt
,
0
,
sizeof
(
pkt
->
pkt
));
}
/*
* Read a packet fragment. Return STATUS_OK if the connection should stay
* open.
*/
int
PacketReceiveFragment
(
Port
*
port
)
{
int
got
;
Packet
*
pkt
=
&
port
->
pktInfo
;
#ifdef USE_SSL
if
(
port
->
ssl
)
got
=
SSL_read
(
port
->
ssl
,
pkt
->
ptr
,
pkt
->
nrtodo
);
else
#endif
#ifndef __BEOS__
got
=
read
(
port
->
sock
,
pkt
->
ptr
,
pkt
->
nrtodo
);
#else
got
=
recv
(
port
->
sock
,
pkt
->
ptr
,
pkt
->
nrtodo
,
0
);
#endif
/* __BEOS__ */
if
(
got
>
0
)
{
pkt
->
nrtodo
-=
got
;
pkt
->
ptr
+=
got
;
/* See if we have got what we need for the packet length. */
if
(
pkt
->
nrtodo
==
0
&&
pkt
->
state
==
ReadingPacketLength
)
{
pkt
->
len
=
ntohl
(
pkt
->
len
);
if
(
pkt
->
len
<
sizeof
(
pkt
->
len
)
||
pkt
->
len
>
sizeof
(
pkt
->
len
)
+
sizeof
(
pkt
->
pkt
))
{
PacketSendError
(
pkt
,
"Invalid packet length"
);
return
STATUS_OK
;
}
/* Set up for the rest of the packet. */
pkt
->
nrtodo
=
pkt
->
len
-
sizeof
(
pkt
->
len
);
pkt
->
ptr
=
(
char
*
)
&
pkt
->
pkt
;
pkt
->
state
=
ReadingPacket
;
}
/* See if we have got what we need for the packet. */
if
(
pkt
->
nrtodo
==
0
&&
pkt
->
state
==
ReadingPacket
)
{
pkt
->
state
=
Idle
;
/* Special case to close the connection. */
if
(
pkt
->
iodone
==
NULL
)
return
STATUS_ERROR
;
return
(
*
pkt
->
iodone
)
(
pkt
->
arg
,
pkt
->
len
-
sizeof
(
pkt
->
len
),
(
void
*
)
&
pkt
->
pkt
);
}
return
STATUS_OK
;
}
if
(
got
==
0
)
return
STATUS_ERROR
;
if
(
errno
==
EINTR
)
return
STATUS_OK
;
perror
(
"PacketReceiveFragment: read() failed"
);
return
STATUS_ERROR
;
}
/*
* Set up a packet write for the postmaster event loop.
*/
void
PacketSendSetup
(
Packet
*
pkt
,
int
nbytes
,
PacketDoneProc
iodone
,
void
*
arg
)
{
pkt
->
len
=
(
PacketLen
)
nbytes
;
pkt
->
nrtodo
=
nbytes
;
pkt
->
ptr
=
(
char
*
)
&
pkt
->
pkt
;
pkt
->
iodone
=
iodone
;
pkt
->
arg
=
arg
;
pkt
->
state
=
WritingPacket
;
}
/*
* Write a packet fragment. Return STATUS_OK if the connection should stay
* open.
*/
int
PacketSendFragment
(
Port
*
port
)
{
int
done
;
Packet
*
pkt
=
&
port
->
pktInfo
;
#ifdef USE_SSL
if
(
port
->
ssl
)
done
=
SSL_write
(
port
->
ssl
,
pkt
->
ptr
,
pkt
->
nrtodo
);
else
#endif
#ifndef __BEOS__
done
=
write
(
port
->
sock
,
pkt
->
ptr
,
pkt
->
nrtodo
);
#else
done
=
send
(
port
->
sock
,
pkt
->
ptr
,
pkt
->
nrtodo
,
0
);
#endif
if
(
done
>
0
)
{
pkt
->
nrtodo
-=
done
;
pkt
->
ptr
+=
done
;
/* See if we have written the whole packet. */
if
(
pkt
->
nrtodo
==
0
)
{
pkt
->
state
=
Idle
;
/* Special case to close the connection. */
if
(
pkt
->
iodone
==
NULL
)
return
STATUS_ERROR
;
return
(
*
pkt
->
iodone
)
(
pkt
->
arg
,
pkt
->
len
,
(
void
*
)
&
pkt
->
pkt
);
}
return
STATUS_OK
;
}
if
(
done
==
0
)
return
STATUS_ERROR
;
if
(
errno
==
EINTR
)
return
STATUS_OK
;
perror
(
"PacketSendFragment: write() failed"
);
return
STATUS_ERROR
;
}
/*
* Send an error message from the postmaster to the frontend.
*/
void
PacketSendError
(
Packet
*
pkt
,
char
*
errormsg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
errormsg
);
pkt
->
pkt
.
em
.
data
[
0
]
=
'E'
;
StrNCpy
(
&
pkt
->
pkt
.
em
.
data
[
1
],
errormsg
,
sizeof
(
pkt
->
pkt
.
em
.
data
)
-
1
);
/*
* The NULL i/o callback will cause the connection to be broken when
* the error message has been sent.
*/
PacketSendSetup
(
pkt
,
strlen
(
pkt
->
pkt
.
em
.
data
)
+
1
,
NULL
,
NULL
);
}
src/include/libpq/libpq-be.h
View file @
a7f6210d
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: libpq-be.h,v 1.2
5 2001/11/05 17:46:33 momjian
Exp $
* $Id: libpq-be.h,v 1.2
6 2001/11/12 04:19:15 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -146,14 +146,4 @@ typedef struct Port
...
@@ -146,14 +146,4 @@ typedef struct Port
extern
ProtocolVersion
FrontendProtocol
;
extern
ProtocolVersion
FrontendProtocol
;
/*
* prototypes for functions in pqpacket.c
*/
void
PacketReceiveSetup
(
Packet
*
pkt
,
PacketDoneProc
iodone
,
void
*
arg
);
int
PacketReceiveFragment
(
Port
*
port
);
void
PacketSendSetup
(
Packet
*
pkt
,
int
nbytes
,
PacketDoneProc
iodone
,
void
*
arg
);
int
PacketSendFragment
(
Port
*
port
);
void
PacketSendError
(
Packet
*
pkt
,
char
*
errormsg
);
#endif
/* LIBPQ_BE_H */
#endif
/* LIBPQ_BE_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment