Annotation of win32/sql/oracle/include/oci/tnsapi.h, revision 1.1.1.1

1.1       parser      1: /* DISABLE check_long_lines */
                      2: /*
                      3:   $Header: /var/lib/cvsroot/parser3/parser3/src/sql/oracle/oracle32/include/oci/tnsapi.h,v 1.1 2001/08/22 14:02:20 parser Exp $
                      4: */
                      5: /* ENABLE check_long_lines */
                      6: 
                      7: /* Copyright (c) 1995, 1996 by Oracle Corporation.  All rights reserved. */
                      8: 
                      9: /*
                     10: 
                     11: NAME
                     12:   tnsapi.h
                     13: 
                     14: DESCRIPTION
                     15:   SQL*Net Open API functions.
                     16: 
                     17: FUNCTIONS
                     18:   tnsopen()    -   open a TNS handle
                     19:   tnsclose()   -   close a TNS handle
                     20:   tnssend()    -   send data over TNS handle
                     21:   tnsrecv()    -   receive data over TNS handle
                     22:   tnscontrol() -   issue a control command on a TNS handle
                     23: 
                     24: 
                     25: NOTES
                     26:   These functions provides transparent access to the underlying session 
                     27:   implementation SQL*NET.
                     28: 
                     29: */
                     30: 
                     31: #ifndef TNSAPI
                     32: #define TNSAPI
                     33: 
                     34: enum tnsapiopcode {
                     35: /* TNS API operations */
                     36:   TNSAPIOOPEN,                
                     37:   TNSAPIOCLOSE,               
                     38:   TNSAPIOSEND,                
                     39:   TNSAPIORECV,
                     40:   TNSAPICTL,
                     41:   TNSAPICNONBLOCKING,
                     42:   TNSAPICBLOCKING
                     43: };
                     44: 
                     45: /* TNS API error codes */
                     46: /* More will be added as actual coding and testing starts */
                     47: /* DISABLE check_naming */
                     48: /* DISABLE check_str_mem */
                     49: enum tnsapierrcode {
                     50:   TNSAPIEBASE = 20000,
                     51: 
                     52:   SDFAIL_TNSAPIE = TNSAPIEBASE+2,
                     53: /*
                     54:  * SDFAIL_TNSAPIE: The underlying "send" command failed in tnssend().
                     55:  */
                     56: 
                     57:   RECVFAIL_TNSAPIE = TNSAPIEBASE+3,
                     58: /*
                     59:  * RECVFAIL_TNSAPIE: The underlying "receive" command failed in tnsrecv().
                     60:  */
                     61: 
                     62:   INVSVROP_TNSAPIE = TNSAPIEBASE+4,
                     63: /*
                     64:  * INVSVROP_TNSAPIE: Operation is invalid as the server.
                     65:  */
                     66: 
                     67:   INVCLIOP_TNSAPIE = TNSAPIEBASE+5,
                     68: /*
                     69:  * INVCLIOP_TNSAPIE: Operation is invalid as the client.
                     70:  */
                     71: 
                     72:   HDLUNINI_TNSAPIE = TNSAPIEBASE+6,
                     73: /*
                     74:  * HDLUNINI_TNSAPIE: The connection should be initialized by 
                     75:  * calling tnsopen(). 
                     76:  */
                     77: 
                     78:   INHFAIL_TNSAPIE = TNSAPIEBASE+7,
                     79: /*
                     80:  * INHFAIL_TNSAPIE: server failed in inheriting the connection from
                     81:  * the listener.
                     82:  */
                     83: 
                     84:   ACPTFAIL_TNSAPIE = TNSAPIEBASE+8,
                     85: /*
                     86:  * ACPTFAIL_TNSAPIE: server failed in accepting the connection request
                     87:  * from the client
                     88:  */
                     89: 
                     90:   NULHDL_TNSAPIE = TNSAPIEBASE+9,
                     91: /*
                     92:  * NULHDL_TNSAPIE: a null handle is passed into the tnsxxx calls, which
                     93:  * is not allowed
                     94:  */
                     95: 
                     96:   INVOP_TNSAPIE = TNSAPIEBASE+10,
                     97: /*
                     98:  * INVOP_TNSAPIE: invalid operation code is passed into tnsapi() call
                     99:  */
                    100: 
                    101:   MALFAIL_TNSAPIE = TNSAPIEBASE+11,
                    102: /*
                    103:  * MALFAIL_TNSAPIE: a malloc failed in TNS API calls
                    104:  */
                    105: 
                    106:   NLINIFAIL_TNSAPIE = TNSAPIEBASE+12,
                    107: /*
                    108:  * NLINIFAIL_TNSAPIE: failed in NL initialization 
                    109:  */
                    110: 
                    111:   NMTOOLONG_TNSAPIE = TNSAPIEBASE+13,
                    112: /*
                    113:  * NMTOOLONG_TNSAPIE: service name too long
                    114:  */
                    115: 
                    116:   CONFAIL_TNSAPIE = TNSAPIEBASE+14,
                    117: /*
                    118:  * CONFAIL_TNSAPIE: client connect request failed
                    119:  */
                    120: 
                    121:   LSNFAIL_TNSAPIE = TNSAPIEBASE+15,
                    122: /*
                    123:  * LSNFAIL_TNSAPIE: server failed to listen for connect request
                    124:  */
                    125: 
                    126:   ANSFAIL_TNSAPIE = TNSAPIEBASE+16,
                    127: /*
                    128:  * ANSFAIL_TNSAPIE: server failed to answer connect request
                    129:  */
                    130: 
                    131:   NMRESFAIL_TNSAPIE = TNSAPIEBASE+17,
                    132: /*
                    133:  * NMRESFAIL_TNSAPIE: failed to resolve service name
                    134:  */
                    135: 
                    136:   WOULDBLOCK_TNSAPIE = TNSAPIEBASE+18,
                    137: /*
                    138:  * WOULDBLOCK_TNSAPIE: operation would block
                    139:  */
                    140: 
                    141:   CTLFAIL_TNSAPIE = TNSAPIEBASE+19,
                    142: /*
                    143:  * CTLFAIL_TNSAPIE: control call failed
                    144:  */
                    145: 
                    146:   TNSAPIE_ERROR = TNSAPIEBASE+20,
                    147: /*
                    148:  * TNSAPIE_ERROR: generic TNS error occured
                    149:  */
                    150: 
                    151:   INVCTL_TNSAPIE = TNSAPIEBASE+21
                    152: /*
                    153:  * INVCTL_TNSAPIE: invalid operation requested in control call
                    154:  */
                    155:  
                    156: };
                    157: /* ENABLE check_str_mem */
                    158: 
                    159: int tnsopen(/*_ void **handlep, const char *name _*/);
                    160: /*
                    161:  * Operation
                    162:  *   TNSOPEN
                    163:  *
                    164:  * Description
                    165:  *   Initialize TNSAPI per-connection handle. This function must be the
                    166:  *   first TNS call that a user makes.
                    167:  *
                    168:  *   Name contains a service name in the same format as those in 
                    169:  *   configuration files in the case of a client. In the case of a server,
                    170:  *   name is a NULL.
                    171:  *
                    172:  * Synopsis
                    173:  *   int tnsopen(handlep, name)
                    174:  *   void **handlep;
                    175:  *   const char *name;
                    176:  *
                    177:  * Paramters
                    178:  *   handlep (IN/OUT) - Address to receive TNS connection handle
                    179:  *   name    (IN)     - service name
                    180:  *      
                    181:  * Requires
                    182:  *   The handlep paramter must not be NULL
                    183:  *
                    184:  * Returns
                    185:  *   Upon successful completion a zero value is returned. Otherwise, a
                    186:  *   positive TNS API error is returned, which is defined in this header 
                    187:  *   file. 
                    188:  */
                    189:  
                    190: int tnsclose(/*_ void **handlep _*/);
                    191: /*
                    192:  * Operation:
                    193:  *  TNSCLOSE
                    194:  *
                    195:  * Description
                    196:  *  Shut down the connection. This function must be called by the user
                    197:  *  to close the connection and release the handle properly.
                    198:  *
                    199:  * Synopsis
                    200:  *   int tnsclose(handlep)
                    201:  *   void **handlep;
                    202:  *
                    203:  * Paramters
                    204:  *   handlep(IN/OUT) - Address of a pointer to a TNS connection handle    
                    205:  * 
                    206:  * Requires
                    207:  *   The handlep paramter must not be NULL
                    208:  *  
                    209:  * Returns
                    210:  *   Upon successful completion a zero value is returned, and *handlep
                    211:  *   is set to NULL. Otherwise, a positive TNS API error number  is 
                    212:  *   returned, which is defined in this header file. 
                    213:  */
                    214: 
                    215: 
                    216: int tnssend(/*_ void *handle, const void *data, size_t *length _*/);
                    217: /*
                    218:  * Operation
                    219:  *   TNSSEND
                    220:  *
                    221:  * Description
                    222:  *   Send data to the TNS handle.
                    223:  *
                    224:  *   In the first call to tnssend() on the client side, connection is
                    225:  *   first established before data is sent to the handle.  The client must 
                    226:  *   first call tnssend() after tnsopen() to establish a connection to the 
                    227:  *   server. It is an error if server calls tnssend() after calling 
                    228:  *   tnsopen().
                    229:  *
                    230:  * Synopsis
                    231:  *   int tnssend(handle, data, length)
                    232:  *   void *handle;
                    233:  *   const void *data;
                    234:  *   size_t *length;
                    235:  *
                    236:  * Paramters
                    237:  *   handle(IN/OUT) - pointer to TNS connection handle returned by 
                    238:  *                    tnsopen() 
                    239:  *   data(IN)   -     pointer to data to be sent
                    240:  *   length(IN/OUT) - pointer to the length of data to be sent in bytes
                    241:  *                    and the actual number of bytes written on return.
                    242:  *
                    243:  * Requires
                    244:  *   The paramters must not be NULL
                    245:  * 
                    246:  * Returns
                    247:  *   Upon successful completion a zero value is returned, and the actual 
                    248:  *   number of bytes written is returned as the value pointed to by the
                    249:  *   length paramter. Otherwise, a positive TNS API error number is 
                    250:  *   returned, which is defined in this header file. 
                    251:  */
                    252: 
                    253: 
                    254: int tnsrecv(/*_ void *handle, void *data, size_t *length _*/);
                    255: /*
                    256:  * Operation
                    257:  *   TNSRECV
                    258:  *
                    259:  * Description
                    260:  *   Receive data from the TNS handle
                    261:  *  
                    262:  *   In the first call to tnsrecv() on the server side, connection is 
                    263:  *   first established before data is received from the handle. The server
                    264:  *   must first call tnsrecv() after tnsopen() to accept the connection
                    265:  *   from the client. 
                    266:  *
                    267:  * Synopsis
                    268:  *   int tnsrecv(handle, data, length)
                    269:  *   void *handle;
                    270:  *   void *data;
                    271:  *   size_t *length;
                    272:  *
                    273:  * Paramters
                    274:  *   handle(IN/OUT) - pointer to TNS connection handle returned by 
                    275:  *                    tnsopen()
                    276:  *   data(IN/OUT)   - pointer to buffer to receive data
                    277:  *   length(IN/OUT) - pointer to the length of buffer to receive data
                    278:  *                    and actual number of bytes received on return
                    279:  *
                    280:  * Requires
                    281:  *   All paramters must not be NULL
                    282:  *  
                    283:  * Returns
                    284:  *   Upon successful completion a zero value is returned, and the actual 
                    285:  *   number of bytes received is returned as the value pointed to by the
                    286:  *   length paramter. Otherwise, a positive TNS API error number is 
                    287:  *   returned, which is defined in this header file.
                    288:  */
                    289: 
                    290: int tnscontrol(/*_ void *handle, int cmd _*/);
                    291: /*
                    292:  * Operation
                    293:  *   TNSCONTROL
                    294:  *
                    295:  * Description
                    296:  *   Set an option on a connection handle.
                    297:  * 
                    298:  * Synopsis
                    299:  *   int tnscontrol(handle, cmd)
                    300:  *   void *handle;
                    301:  *   int cmd;
                    302:  * 
                    303:  * Parameters
                    304:  *   handle(IN) - pointer to TNS connection handle as returned by tnsopen().
                    305:  *   cmd(IN) - option to apply to the connection.  Currently supported 
                    306:  *             values are:
                    307:  *     TNSAPICNONBLOCKING - set connection into nonblocking mode
                    308:  *     TNSAPICBLOCKING - set connection into blocking mode
                    309:  * 
                    310:  * Requires
                    311:  *   handle must not be NULL, and cmd must be one of the supported commands.
                    312:  * 
                    313:  * Returns
                    314:  *   0 if option is successfully set
                    315:  *   CTLFAIL_TNSAPIE if a TNS error occurs while performing the control call
                    316:  */
                    317:   
                    318: 
                    319: /*
                    320:  * Public macro interfaces 
                    321:  */
                    322: #define tnsopen(handlep, name) tnsapi(TNSAPIOOPEN, handlep, name)
                    323: #define tnsclose(handlep) tnsapi(TNSAPIOCLOSE, handlep)
                    324: #define tnssend(handle, data, length) tnsapi(TNSAPIOSEND, handle, data, length)
                    325: #define tnsrecv(handle, data, length) tnsapi(TNSAPIORECV, handle, data, length)
                    326: #define tnscontrol(handle, cmd) tnsapi(TNSAPICTL, handle, cmd)
                    327: 
                    328: /* ENABLE check_naming */
                    329: 
                    330: #endif /* TNSAPI */

E-mail: