-
Notifications
You must be signed in to change notification settings - Fork 0
/
sapnwrfc.h
5772 lines (5342 loc) · 294 KB
/
sapnwrfc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef SAPNWRFC_H
#define SAPNWRFC_H
#include <stdlib.h>
#include <stdio.h>
#ifndef SAPTYPE_H
#include "sapucrfc.h"
#endif /* SAPTYPE_H */
#ifndef DECL_EXP
# if defined(SAPonLIN) && defined(GCC_HIDDEN_VISIBILITY)
# define DECL_EXP __attribute__((visibility("default")))
# elif defined(SAPonDARW) && !defined(CPP_USE_STLPORT)
# define DECL_EXP __attribute__((visibility("default")))
# else
# define DECL_EXP
# endif
#endif /* DECL_EXP */
#ifndef SAP_API
#ifdef SAPonNT
# define SAP_API _stdcall
#else
# define SAP_API
#endif /* SAPonNT */
#endif /* SAP_API */
#ifdef SAPonNT
#pragma warning (disable : 4267) // disable warning: conversion from 'size_t' to 'const unsigned int'
#endif
#if defined(SAPonOS390) && defined(__XPLINK__) && __CHARSET_LIB == 1
#pragma runopts("FILETAG(AUTOCVT,AUTOTAG)")
#endif
#if defined SAPwith64_BIT && \
! defined SAPonNT && \
! defined SAPonOS400 && \
! defined SAPccQ
typedef long RFC_INT8; /* this requires the LP64 data model */
#elif defined SAPonHPPA || \
defined SAPonRS6000 || \
defined SAPonSUN || \
defined SAPonOS390 || \
defined SAPonOS400 || \
defined SAPonDARW || \
defined SAPonLIN
typedef long long RFC_INT8;
#elif defined SAPonNT
typedef __int64 RFC_INT8;
#endif
/* RFC scalar data type mappings */
typedef SAP_UC RFC_CHAR; ///< Characters, RFCTYPE_CHAR
typedef RFC_CHAR RFC_NUM; ///< Digits, RFCTYPE_NUM /*SAPUNICODEOK_CHARTYPE*/
typedef SAP_RAW RFC_BYTE; ///< Raw data, RFCTYPE_BYTE
typedef SAP_RAW RFC_BCD; ///< Packed numbers, RFCTYPE_BCD /*SAPUNICODEOK_CHARTYPE*/
typedef SAP_RAW RFC_INT1; ///< 1 byte integer, RFCTYPE_INT1
typedef short RFC_INT2; ///< 2 byte integer, RFCTYPE_INT2
typedef int RFC_INT; ///< 4 byte integer, RFCTYPE_INT
typedef double RFC_FLOAT; ///< Floating point, double precision, RFCTYPE_FLOAT
typedef RFC_CHAR RFC_DATE[8]; ///< Date, RFCTYPE_DATE (YYYYMMDD)
typedef RFC_CHAR RFC_TIME[6]; ///< Time, RFCTYPE_TIME (HHMMSS)
typedef DecFloat16 RFC_DECF16; ///< IEEE 754r decimal floating point, 8 bytes
typedef DecFloat34 RFC_DECF34; ///< IEEE 754r decimal floating point, 16 bytes
typedef RFC_INT8 RFC_UTCLONG ; ///< timestamp/long
typedef RFC_INT8 RFC_UTCSECOND ; ///< timestamp/second
typedef RFC_INT8 RFC_UTCMINUTE ; ///< timestamp/minute
typedef int RFC_DTDAY ; ///< date/day
typedef int RFC_DTWEEK ; ///< date/week
typedef int RFC_DTMONTH ; ///< date/month
typedef int RFC_TSECOND ; ///< time/second
typedef short RFC_TMINUTE ; ///< time/minute
typedef short RFC_CDAY ; ///< Calandendar day: Day and month
#define RFC_TID_LN 24
#define RFC_UNITID_LN 32
typedef SAP_UC RFC_TID[RFC_TID_LN+1]; ///< Used for TIDs in inbound and outbound tRFC/qRFC
typedef SAP_UC RFC_UNITID[RFC_UNITID_LN+1]; ///< Used for Unit IDs in inbound and outbound bgRFC
/** \enum _RFCTYPE
* \ingroup api
*
* RFCTYPE is used in field descriptions (#RFC_FIELD_DESC) and parameter descriptions
* (#RFC_PARAMETER_DESC) and denotes the ABAP data type of the corresponding field/parameter.
*/
typedef enum _RFCTYPE
{
RFCTYPE_CHAR = 0, ///< 1-byte or multibyte character, fixed size, blank padded
RFCTYPE_DATE = 1, ///< Date ( YYYYYMMDD )
RFCTYPE_BCD = 2, ///< Packed number, any length between 1 and 16 bytes
RFCTYPE_TIME = 3, ///< Time (HHMMSS)
RFCTYPE_BYTE = 4, ///< Raw data, binary, fixed length, zero padded.
RFCTYPE_TABLE = 5, ///< Internal table
RFCTYPE_NUM = 6, ///< Digits, fixed size, leading '0' padded.
RFCTYPE_FLOAT = 7, ///< Floating point, double precision
RFCTYPE_INT = 8, ///< 4-byte integer
RFCTYPE_INT2 = 9, ///< 2-byte integer. Obsolete, not directly supported by ABAP/4
RFCTYPE_INT1 = 10, ///< 1-byte integer, unsigned. Obsolete, not directly supported by ABAP/4
RFCTYPE_NULL = 14, ///< Not supported data type.
RFCTYPE_ABAPOBJECT = 16,///< ABAP object.
RFCTYPE_STRUCTURE = 17, ///< ABAP structure
RFCTYPE_DECF16 = 23, ///< IEEE 754r decimal floating point, 8 bytes
RFCTYPE_DECF34 = 24, ///< IEEE 754r decimal floating point, 16 bytes
RFCTYPE_XMLDATA = 28, ///< No longer used!
RFCTYPE_STRING = 29, ///< Variable-length, null-terminated string
RFCTYPE_XSTRING = 30, ///< Variable-length raw string, length in bytes
RFCTYPE_INT8, ///< 8-byte integer
RFCTYPE_UTCLONG , ///< timestamp/long, 8-byte integer
RFCTYPE_UTCSECOND , ///< timestamp/second, 8-byte integer
RFCTYPE_UTCMINUTE , ///< timestamp/minute, 8-byte integer
RFCTYPE_DTDAY , ///< date/day , 4-byte integer
RFCTYPE_DTWEEK , ///< date/week, 4-byte integer
RFCTYPE_DTMONTH , ///< date/month, 4-byte integer
RFCTYPE_TSECOND , ///< time/second, 4-byte integer
RFCTYPE_TMINUTE , ///< time/minute, 2-byte integer
RFCTYPE_CDAY , ///< calendar day, 2-byte integer
RFCTYPE_BOX , ///< boxed structure, note: not supported by NW RFC lib
RFCTYPE_GENERIC_BOX, ///< boxed client dependent structure, note: not supported by NW RFC lib
_RFCTYPE_max_value ///< the max. value of RFCTYPEs
}RFCTYPE;
/** \enum _RFC_RC
* \ingroup api
*
* RFC return codes used by all functions that do not directly return a handle.
* Also used as error indicator in the structure #RFC_ERROR_INFO::code.
*/
typedef enum _RFC_RC
{
RFC_OK, ///< Everything O.K. Used by every function
RFC_COMMUNICATION_FAILURE, ///< Error in Network & Communication layer
RFC_LOGON_FAILURE, ///< Unable to logon to SAP system. Invalid password, user locked, etc.
RFC_ABAP_RUNTIME_FAILURE, ///< SAP system runtime error (SYSTEM_FAILURE): Shortdump on the backend side
RFC_ABAP_MESSAGE, ///< The called function module raised an E-, A- or X-Message
RFC_ABAP_EXCEPTION, ///< The called function module raised an Exception (RAISE or MESSAGE ... RAISING)
RFC_CLOSED, ///< Connection closed by the other side
RFC_CANCELED, ///< No longer used
RFC_TIMEOUT, ///< Time out
RFC_MEMORY_INSUFFICIENT, ///< Memory insufficient
RFC_VERSION_MISMATCH, ///< Version mismatch
RFC_INVALID_PROTOCOL, ///< The received data has an unsupported format
RFC_SERIALIZATION_FAILURE, ///< A problem while serializing or deserializing RFM parameters
RFC_INVALID_HANDLE, ///< An invalid handle was passed to an API call
RFC_RETRY, ///< RfcListenAndDispatch did not receive an RFC request during the timeout period
RFC_EXTERNAL_FAILURE, ///< Error in external custom code. (E.g. in the function handlers or tRFC handlers.) Results in SYSTEM_FAILURE
RFC_EXECUTED, ///< Inbound tRFC Call already executed (needs to be returned from RFC_ON_CHECK_TRANSACTION in case the TID is already known and successfully processed before.)
RFC_NOT_FOUND, ///< Function or structure definition not found (Metadata API)
RFC_NOT_SUPPORTED, ///< The operation is not supported on that handle
RFC_ILLEGAL_STATE, ///< The operation is not supported on that handle at the current point of time (e.g. trying a callback on a server handle, while not in a call)
RFC_INVALID_PARAMETER, ///< An invalid parameter was passed to an API call, (e.g. invalid name, type or length)
RFC_CODEPAGE_CONVERSION_FAILURE, ///< Codepage conversion error
RFC_CONVERSION_FAILURE, ///< Error while converting a parameter to the correct data type
RFC_BUFFER_TOO_SMALL, ///< The given buffer was to small to hold the entire parameter. Data has been truncated.
RFC_TABLE_MOVE_BOF, ///< Trying to move the current position before the first row of the table
RFC_TABLE_MOVE_EOF, ///< Trying to move the current position after the last row of the table
RFC_START_SAPGUI_FAILURE, ///< Failed to start and attach SAPGUI to the RFC connection
RFC_ABAP_CLASS_EXCEPTION, ///< The called function module raised a class based exception
RFC_UNKNOWN_ERROR, ///< "Something" went wrong, but I don't know what...
RFC_AUTHORIZATION_FAILURE, ///< Authorization check error
RFC_AUTHENTICATION_FAILURE, ///< The authentication handler (RFC_ON_AUTHENTICATION_CHECK) failed to authenticate the user trying to log on
RFC_CRYPTOLIB_FAILURE, ///< Error when dealing with functions provided by the cryptolibrary
RFC_IO_FAILURE, ///< Error when dealing with io functions, streams etc
_RFC_RC_max_value ///< Don't use
}RFC_RC;
/** \enum _RFC_ERROR_GROUP
* \ingroup api
*
* Groups several error conditions together, depending on the "layer" to which they belong.
* Used in the structure #RFC_ERROR_INFO::group.
*/
typedef enum _RFC_ERROR_GROUP
{
OK, ///< OK
ABAP_APPLICATION_FAILURE, ///< ABAP Exception raised in ABAP function modules
ABAP_RUNTIME_FAILURE, ///< ABAP Message raised in ABAP function modules or in ABAP runtime of the backend (e.g Kernel)
LOGON_FAILURE, ///< Error message raised when logon fails
COMMUNICATION_FAILURE, ///< Problems with the network connection (or backend broke down and killed the connection)
EXTERNAL_RUNTIME_FAILURE, ///< Problems in the RFC runtime of the external program (i.e "this" library)
EXTERNAL_APPLICATION_FAILURE, ///< Problems in the external program (e.g in the external server implementation)
EXTERNAL_AUTHORIZATION_FAILURE, ///< Problems raised in the authorization check handler provided by the external server implementation
EXTERNAL_AUTHENTICATION_FAILURE,///< Problems raised by the authentication handler (RFC_ON_AUTHENTICATION_CHECK)
CRYPTOLIB_FAILURE ///< Problems when dealing with functions provided by the cryptolibrary
}RFC_ERROR_GROUP;
/** \struct _RFC_ERROR_INFO
* \ingroup api
*
* Used in all functions of the NW RFC library to return detailed information about
* an error that has just occurred. This can be an error that the communication partner
* sent back to us, an error that occurred in the network layer or operating system,
* an internal error in the NW RFC library or an error that the application programmer
* (i.e. you) has committed...
*
* Within a server function implementation, the application programmer (you) can return
* this structure to the RFC library in order to specify the error type & message that
* you want to send back to the backend.
*/
typedef struct _RFC_ERROR_INFO
{
RFC_RC code; ///< Error code. Should be the same as the API returns if the API has return type RFC_RC
RFC_ERROR_GROUP group; ///< Error group
SAP_UC key[128]; ///< Error key
SAP_UC message[512]; ///< Error message
SAP_UC abapMsgClass[20+1]; ///< ABAP message ID , or class
SAP_UC abapMsgType[1+1]; ///< ABAP message type, e.g. 'E', 'A' or 'X'
RFC_NUM abapMsgNumber[3 + 1]; ///< ABAP message number
SAP_UC abapMsgV1[50+1]; ///< ABAP message details field 1, corresponds to SY-MSGV1
SAP_UC abapMsgV2[50+1]; ///< ABAP message details field 2, corresponds to SY-MSGV2
SAP_UC abapMsgV3[50+1]; ///< ABAP message details field 3, corresponds to SY-MSGV3
SAP_UC abapMsgV4[50+1]; ///< ABAP message details field 4, corresponds to SY-MSGV4
}RFC_ERROR_INFO;
/** \struct _RFC_ATTRIBUTES
* \ingroup connection
*
* Structure returned by RfcGetConnectionAttributes() giving some
* information about the partner system on the other side of this RFC connection.
*/
typedef struct _RFC_ATTRIBUTES
{
SAP_UC dest[64+1]; ///< RFC destination
SAP_UC host[100+1]; ///< Own host name
SAP_UC partnerHost[100+1]; ///< Partner host name
SAP_UC sysNumber[2+1]; ///< R/3 system number
SAP_UC sysId[8+1]; ///< R/3 system ID
SAP_UC client[3+1]; ///< Client ("Mandant")
SAP_UC user[12+1]; ///< User
SAP_UC language[2+1]; ///< Language
SAP_UC trace[1+1]; ///< Trace level (0-3)
SAP_UC isoLanguage[2+1]; ///< 2-byte ISO-Language
SAP_UC codepage[4+1]; ///< Own code page
SAP_UC partnerCodepage[4+1]; ///< Partner code page
SAP_UC rfcRole[1+1]; ///< C/S: RFC Client / RFC Server
SAP_UC type[1+1]; ///< 2/3/E/R: R/2,R/3,Ext,Reg.Ext
SAP_UC partnerType[1+1]; ///< 2/3/E/R: R/2,R/3,Ext,Reg.Ext
SAP_UC rel[4+1]; ///< My system release
SAP_UC partnerRel[4+1]; ///< Partner system release
SAP_UC kernelRel[4+1]; ///< Partner kernel release
SAP_UC cpicConvId[8 + 1]; ///< CPI-C Conversation ID
SAP_UC progName[128+1]; ///< Name of the calling APAB program (report, module pool)
SAP_UC partnerBytesPerChar[1+1];///< Number of bytes per character in the backend's current codepage. Note this is different from the semantics of the PCS parameter.
SAP_UC partnerSystemCodepage[4 + 1]; ///< Partner system code page
SAP_UC partnerIP[15 + 1]; ///< Partner IP
SAP_UC partnerIPv6[45 + 1]; ///< Partner IPv6
SAP_UC reserved[17]; ///< Reserved for later use
}RFC_ATTRIBUTES, *P_RFC_ATTRIBUTES;
/** \struct _RFC_SECURITY_ATTRIBUTES
* \ingroup connection
*
* Structure passed to the RFC_SERVER_AUTHORIZATION_HANDLER giving some
* security related information about the calling ABAP partner of an incoming RFC call.
*/
typedef struct _RFC_SECURITY_ATTRIBUTES
{
SAP_UC *functionName; ///< Name of the called function module
SAP_UC *sysId; ///< Calling ABAP system ID
SAP_UC *client; ///< ABAP Client ("Mandant")
SAP_UC *user; ///< ABAP User
SAP_UC *progName; ///< Name of the calling APAB program (report, module pool)
SAP_UC *sncName; ///< SNC name of the calling ABAP system, if SNC is enabled. Use this only for display or logging purposes.
SAP_UC *ssoTicket; ///< Logon ticket of the ABAP user, if SSO2 or assertion tickets are enabled
SAP_RAW *sncAclKey; ///< Canonical representation of the SNC name of the calling ABAP system, if SNC is enabled. Use this for comparisons and access checks.
unsigned sncAclKeyLength; ///< Length of the above SNC AclKey
}RFC_SECURITY_ATTRIBUTES, *P_RFC_SECURITY_ATTRIBUTES;
/** \struct _RFC_UNIT_ATTRIBUTES
* \ingroup bgrfc
*
* If the external program is the sender of the bgRFC unit, this structure is used to set a
* bunch of special attributes that determine, how a bgRFC Unit will be processed in the backend.
* The fields user, client, tCode and program are optional. If left empty, the NW RFC lib will
* fill them with default values. The fields hostname, sendingDate and sendingTime should not be
* filled, the lib fills them, when the unit is submitted.
*
* If the external program is the receiver of the bgRFC unit, you can use RfcGetServerContext()
* to obtain the values that were sent by the backend.
*/
typedef struct _RFC_UNIT_ATTRIBUTES{
short kernelTrace; ///< If != 0, the backend will write kernel traces, while executing this unit.
short satTrace; ///< If != 0, the backend will write statistic records, while executing this unit.
short unitHistory; ///< If != 0, the backend will keep a "history" for this unit.
short lock; ///< Used only for type Q: If != 0, the unit will be written to the queue, but not processed. The unit can then be started manually in the ABAP debugger.
short noCommitCheck; ///< Per default the backend will check during execution of a unit, whether one
///< of the unit's function modules triggers an explicit or implicit COMMIT WORK.
///< In this case the unit is aborted with an error, because the transactional
///< integrity of this unit cannot be guaranteed. By setting "noCommitCheck" to
///< true (!=0), this behavior can be suppressed, meaning the unit will be executed
///< anyway, even if one of its function modules "misbehaves" and triggers a COMMIT WORK.
SAP_UC user[12+1]; ///< Sender User (optional). Default is current operating system User.
SAP_UC client[3+1]; ///< Sender Client ("Mandant") (optional). Default is "000".
SAP_UC tCode[20+1]; ///< Sender Transaction Code (optional). Default is "".
SAP_UC program[40+1]; ///< Sender Program (optional). Default is current executable name.
SAP_UC hostname[40+1]; ///< Sender hostname. Used only when the external program is server. In the client case the nwrfclib fills this automatically.
RFC_DATE sendingDate; ///< Sending date in UTC (GMT-0). Used only when the external program is server. In the client case the nwrfclib fills this automatically.
RFC_TIME sendingTime; ///< Sending time in UTC (GMT-0). Used only when the external program is server. In the client case the nwrfclib fills this automatically.
}RFC_UNIT_ATTRIBUTES;
/** \struct _RFC_UNIT_IDENTIFIER
* \ingroup bgrfc
*
* For convenience combines a unit's ID and its type.
*/
typedef struct _RFC_UNIT_IDENTIFIER{
SAP_UC unitType; ///< 'T' for "transactional" behavior (unit is executed synchronously), 'Q' for "queued" behavior (unit is written into a queue and executed asynchronously)
RFC_UNITID unitID; ///< The 32 digit unit ID of the background unit.
}RFC_UNIT_IDENTIFIER;
/** \enum _RFC_UNIT_STATE
* \ingroup bgrfc
*
* Used in RfcGetUnitState() for inquiring the processing status of a background Unit that
* we (or someone else) sent into this backend.
*/
typedef enum _RFC_UNIT_STATE{
RFC_UNIT_NOT_FOUND, ///< No information for this unit ID and unit type can be found in the target system. If you are sure, that target system, unit ID and unit type are correct, it means that your previous attempt did not even reach the target system. Send the unit again. However, if you get this status after the Confirm step has already been executed, it means that everything is ok. Don't re-execute in this case!
RFC_UNIT_IN_PROCESS, ///< Backend system is still in the process of persisting (or executing if type 'T') the payload data. Give it some more time and check the state again later. If this takes "too long", an admin should probably have a look at why there is no progress here.
RFC_UNIT_COMMITTED, ///< Data has been persisted (or executed if type 'T') ok on receiver side. Confirm event may now be triggered.
RFC_UNIT_ROLLED_BACK, ///< An error of any type has occurred. Unit needs to be resent.
RFC_UNIT_CONFIRMED ///< Temporary state between the Confirm event and the time, when the status data will be erased for good. Nothing to be done. Just delete the payload and status information on your side.
}RFC_UNIT_STATE;
typedef RFC_CHAR RFC_ABAP_NAME[30+1]; ///< Name of ABAP function, function parameter or field in a structure. (null-terminated)
typedef RFC_CHAR RFC_PARAMETER_DEFVALUE[30+1]; ///< Default value of a function module parameter. (null-terminated)
typedef RFC_CHAR RFC_PARAMETER_TEXT[79+1]; ///< Parameter description for a function module parameter. (null-terminated)
/** \enum _RFC_CALL_TYPE
* \ingroup connection
*
* Used in RfcGetServerContext() for inquiring the type of
* an incoming function call from the backend.
*/
typedef enum _RFC_CALL_TYPE{
RFC_SYNCHRONOUS, ///< It's a standard synchronous RFC call.
RFC_TRANSACTIONAL, ///< This function call is part of a transactional LUW (tRFC).
RFC_QUEUED, ///< This function call is part of a queued LUW (qRFC).
RFC_BACKGROUND_UNIT ///< This function call is part of a background LUW (bgRFC).
}RFC_CALL_TYPE;
/** \struct _RFC_SERVER_CONTEXT
* \ingroup connection
*
* Used in RfcGetServerContext() for obtaining more information about the
* current incoming function call.
*/
typedef struct _RFC_SERVER_CONTEXT{
RFC_CALL_TYPE type; ///< Specifies the type of function call. Depending on the value of this field, some of the other fields of this struct may be filled.
RFC_TID tid; ///< If type is RFC_TRANSACTIONAL or RFC_QUEUED, this field is filled with the 24 digit TID of the tRFC/qRFC unit.
RFC_UNIT_IDENTIFIER* unitIdentifier; ///< If type is RFC_BACKGROUND_UNIT, this pointer is set to the unit identifier of the LUW. Note: the pointer is valid only during the execution context of your server function.
RFC_UNIT_ATTRIBUTES* unitAttributes; ///< If type is RFC_BACKGROUND_UNIT, this pointer is set to the unit attributes of the LUW. Note: the pointer is valid only during the execution context of your server function.
unsigned isStateful; ///< Specifies whether the current server connection is processing stateful RFC requests (assigned permanently to one fixed ABAP user session).
SAP_UC sessionID[33]; ///< Contains a unique zero-terminated session ID, identifying the ABAP or external user session. Can be used in stateful servers to store session context in a hashmap.
}RFC_SERVER_CONTEXT;
/** \enum _RFC_AUTHENTICATION_TYPE
* \ingroup autoserver
*
* Type of authentication method used by the backend authentication handler (RFC_ON_AUTHENTICATION_CHECK).
*/
typedef enum _RFC_AUTHENTICATION_TYPE{
RFC_AUTH_NONE, ///< No authentication data was provided
RFC_AUTH_BASIC, ///< Authentication with user and password
RFC_AUTH_X509, ///< Authentication with x509 certificate
RFC_AUTH_SSO ///< Authentication with assertion ticket
}RFC_AUTHENTICATION_TYPE;
/** \struct _RFC_CERTIFICATE_DATA
* \ingroup autoserver
*
* Compact structure containing relevant information about the x509 certificate provided by the RFC client. Can be accessed by the
* authentication handler (RFC_ON_AUTHENTICATION_CHECK) and used for validating the user trying to log on.
*/
typedef struct _RFC_CERTIFICATE_DATA{
const SAP_UC* subject; ///< Distinguished name of the user of the certificate
const SAP_UC* issuer; ///< Distinguished name of the certificate authority (CA) that issued the certificate
SAP_ULLONG validTo; ///< UTC Expiration date on which the certificate is no longer considered valid
SAP_ULLONG validFrom; ///< UTC Starting date since the certificate is valid
const SAP_UC* signature; ///< Fingerprint of the public key
struct _RFC_CERTIFICATE_DATA* next; ///< Pointer to the next certificate in the chain if any
}RFC_CERTIFICATE_DATA;
/** \struct _RFC_TYPE_DESC_HANDLE
* \ingroup repository
*
* Handle to a cached metadata description of a structure or table type.
*/
typedef struct _RFC_TYPE_DESC_HANDLE {void* handle;} *RFC_TYPE_DESC_HANDLE;
/** \struct _RFC_FUNCTION_DESC_HANDLE
* \ingroup repository
*
* Handle to a cached metadata description of a function module.
*/
typedef struct _RFC_FUNCTION_DESC_HANDLE {void* handle;} *RFC_FUNCTION_DESC_HANDLE;
/** \struct _RFC_CLASS_DESC_HANDLE
* \ingroup repository
*
* Handle to a cached metadata description of a class.
*/
typedef struct _RFC_CLASS_DESC_HANDLE {void* handle;} *RFC_CLASS_DESC_HANDLE;
/** \struct RFC_DATA_CONTAINER
* \ingroup container
*
* Handle to a general data container (structure, table or function module).
*/
typedef struct RFC_DATA_CONTAINER {void* handle;} *DATA_CONTAINER_HANDLE;
/** \struct RFC_STRUCTURE_HANDLE
* \ingroup container
*
* Handle to a data container for a structure.
*/
typedef DATA_CONTAINER_HANDLE RFC_STRUCTURE_HANDLE;
/** \struct RFC_FUNCTION_HANDLE
* \ingroup container
*
* Handle to a data container for a function module.
*/
typedef DATA_CONTAINER_HANDLE RFC_FUNCTION_HANDLE;
/** \struct RFC_TABLE_HANDLE
* \ingroup container
*
* Handle to a data container for a table.
*/
typedef DATA_CONTAINER_HANDLE RFC_TABLE_HANDLE;
/** \struct RFC_ABAP_OBJECT_HANDLE
* \ingroup container
*
* Handle to a data container for an ABAP object instance.
*/
typedef DATA_CONTAINER_HANDLE RFC_ABAP_OBJECT_HANDLE;
/** \struct _RFC_THROUGHPUT_HANDLE
* \ingroup throughput
*
* Handle to a throughput object which can monitor performance relevant data of connections and servers.
* Returned by RfcCreateThroughput() or RfcGetThroughput().
*/
typedef struct _RFC_THROUGHPUT_HANDLE {void* handle;} *RFC_THROUGHPUT_HANDLE;
/** \struct _RFC_AUTHENTICATION_HANDLE
* \ingroup autoserver
*
* Handle to an authentication object which gives access to relevant authentication data received from the client.
* This data can be used to authenticate users in the authentication handler (RFC_ON_AUTHENTICATION_CHECK).
* Passed into the authentication handler (RFC_ON_AUTHENTICATION_CHECK) by the NW RFC library
*/
typedef struct _RFC_AUTHENTICATION_HANDLE {void* handle;} *RFC_AUTHENTICATION_HANDLE;
/** \struct _RFC_CONNECTION_HANDLE
* \ingroup connection
*
* Handle to an RFC connection (client connection or server connection).
* Returned by RfcOpenConnection() or RfcRegisterServer().
*/
typedef struct _RFC_CONNECTION_HANDLE {void* handle;} *RFC_CONNECTION_HANDLE;
/* Definitions for standalone Server */
/** \struct _RFC_SERVER_HANDLE
* \ingroup autoserver
*
* Handle to an automated ("multi-count") RFC Server, which can manage multiple parallel listening server sessions.
* Returned by RfcCreateServer().
*/
typedef struct _RFC_SERVER_HANDLE {void* handle;} *RFC_SERVER_HANDLE;
/** \enum _RFC_PROTOCOL_TYPE
* \ingroup connection
*
* Used in state information in order to indicate the different types of RFC programs, RFC Server types, etc.
*/
typedef enum _RFC_PROTOCOL_TYPE{
RFC_UNKOWN, ///< Unspecified
RFC_CLIENT, ///< RFC Client
RFC_STARTED_SERVER, ///< Started RFC Server
RFC_REGISTERED_SERVER, ///< Registered RFC Server
RFC_MULTI_COUNT_REGISTERED_SERVER,///< Multi-count registered RFC Server
RFC_TCP_SOCKET_CLIENT, ///< TCP Client
RFC_TCP_SOCKET_SERVER, ///< TCP Server
RFC_WEBSOCKET_CLIENT, ///< Websocket RFC Client
RFC_WEBSOCKET_SERVER, ///< Websocket RFC Server
RFC_PROXY_WEBSOCKET_CLIENT ///< Websocket RFC Client
}RFC_PROTOCOL_TYPE;
/** \enum _RFC_SERVER_STATE
* \ingroup autoserver
*
* Used in state information in order to indicate the current state of an RFC Server.
*/
typedef enum _RFC_SERVER_STATE {
RFC_SERVER_INITIAL, ///< The server object has been created, but nothing has been done with it yet.
RFC_SERVER_STARTING,///< The server has been started, but startup is not yet complete and the server is not yet able to receive/serve requests. Should quickly switch to RUNNING or BROKEN.
RFC_SERVER_RUNNING, ///< Means at least one registration is still able to accept request from the gateway (in case of Registered Server), or that the server port is open and listening (in case of TCP Socket Server).
RFC_SERVER_BROKEN, ///< Means that all registrations are dead, e.g. because of gateway being down (in case of Registered Server), or that for some reason server port could not be opened (in case of TCP Socket Server).
RFC_SERVER_STOPPING,///< The server has been stopped via RfcShutdownServer() (with a timeout > 0) and is still busy processing ongoing requests. It is however no longer accepting new requests. Should switch to STOPPED, once the ongoing requests are finished.
RFC_SERVER_STOPPED ///< The server has been stopped via RfcShutdownServer() and is currently not processing nor accepting any requests. The object, however, is still valid and can be started again anytime with RfcLaunchServer().
} RFC_SERVER_STATE;
/** \struct _RFC_SERVER_ATTRIBUTES
* \ingroup autoserver
*
* Information about an RFC Server returned by RfcGetServerAttributes().
*/
typedef struct _RFC_SERVER_ATTRIBUTES{
SAP_UC* serverName; ///< This server's name as given when creating the server.
RFC_PROTOCOL_TYPE type; ///< This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER.
unsigned registrationCount; ///< The current number of active registrations (in case of a Registered Server) or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server).
RFC_SERVER_STATE state; ///< This server's state.
unsigned currentBusyCount; ///< The number of requests currently being processed.
unsigned peakBusyCount; ///< The maximum number of requests the server has been processing in parallel since it has been created.
} RFC_SERVER_ATTRIBUTES;
/** \enum _RFC_SESSION_EVENT
* \ingroup autoserver
*
* Used in a server session change listener to notify the application whenever a new user session on the server gets started or ends.
*/
typedef enum _RFC_SESSION_EVENT{
RFC_SESSION_CREATED, ///< A new stateful user session has been created on the server. This can be done either by the server itself via RfcSetServerStateful(), or by the backend via function module RFC_SET_REG_SERVER_PROPERTY
RFC_SESSION_ACTIVATED, ///< A function call came in from the backend and started processing. This event can probably be ignored by 99% of the applications.
RFC_SESSION_PASSIVATED, ///< A function call completed processing. This event can probably be ignored by 99% of the applications.
RFC_SESSION_DESTROYED ///< A stateful user session has been destroyed, either by the server itself via RfcSetServerStateful(), or by the backend via function module RFC_SET_REG_SERVER_PROPERTY, or because the connection was closed (e.g. the corresponding ABAP user session ended or explicitly closed the connection), or because the connection was broken by network error/system failure etc. The application should now clean up all memory/resources allocated for the given session ID.
} RFC_SESSION_EVENT;
/** \struct _RFC_SESSION_CHANGE
* \ingroup autoserver
*
* Notifies an RFC Server that a stateful user session has just been created or destroyed.
*/
typedef struct _RFC_SESSION_CHANGE {
SAP_UC sessionID[30 + 1]; ///< Session ID of the user session in question
RFC_SESSION_EVENT event; ///< What has been done with that session
} RFC_SESSION_CHANGE;
typedef RFC_RC (SAP_API* RFC_SERVER_SESSION_CHANGE_LISTENER)(RFC_SERVER_HANDLE serverHandle, RFC_SESSION_CHANGE* sessionChange);
typedef void (SAP_API* RFC_SERVER_ERROR_LISTENER)(RFC_SERVER_HANDLE serverHandle, RFC_ATTRIBUTES* clientInfo, RFC_ERROR_INFO* errorInfo);
/** \struct _RFC_STATE_CHANGE
* \ingroup autoserver
*
* Notifies the application that an RFC Server changed its state (e.g. got started, got shutdown, lost its connection to the backend etc.).
*/
typedef struct _RFC_STATE_CHANGE {
RFC_SERVER_STATE oldState; ///< Previous state of the given server
RFC_SERVER_STATE newState; ///< New state of the given server
} RFC_STATE_CHANGE;
typedef void (SAP_API* RFC_SERVER_STATE_CHANGE_LISTENER)(RFC_SERVER_HANDLE serverHandle, RFC_STATE_CHANGE* stateChange);
/** \struct _RFC_SERVER_MONITOR_DATA
* \ingroup autoserver
*
* Allows to retrieve monitoring information about all busy or idle connections of an automated RFC Server via RfcGetServerConnectionMonitorData().
*/
typedef struct _RFC_SERVER_MONITOR_DATA{
RFC_ATTRIBUTES* clientInfo; ///< Pointer to an RFC_ATTRIBUTES structure containing information about this particular client connection.
int isActive; ///< 1, if this connection is currently processing a call, 0, if it is idle.
int isStateful; ///< If this connection is currently processing a call, this flag indicates, whether it is a stateful or stateless call: 0 = stateless, 1 = stateful.
SAP_UC functionModuleName[128]; ///< Name of the ABAP function module currently being processed over this connection (if the connection is currently active), or empty (if the connection is idle).
time_t lastActivity; ///< Point of time of the last activity on this connection (if the connection is currently idle), or not used (if the connection is busy).
} RFC_SERVER_MONITOR_DATA;
/** \struct _RFC_TRANSACTION_HANDLE
* \ingroup transaction
*
* Handle to a data container for a tRFC/qRFC LUW.
* Can be filled with several RFC_FUNCTION_HANDLEs.
*/
typedef struct _RFC_TRANSACTION_HANDLE {void* handle;} *RFC_TRANSACTION_HANDLE;
/** \struct _RFC_UNIT_HANDLE
* \ingroup bgrfc
*
* Handle to a data container for a bgRFC LUW.
* Can be filled with several RFC_FUNCTION_HANDLEs.
*/
typedef struct _RFC_UNIT_HANDLE {void* handle;} *RFC_UNIT_HANDLE;
/** \struct _RFC_CONNECTION_PARAMETER
* \ingroup connection
*
* Structure used for connecting to a backend system via RfcOpenConnection() or
* RfcRegisterServer(). For a list of supported parameters see these two functions or the file sapnwrfc.ini, which gives a complete list of all possible connection parameters.
*/
typedef struct _RFC_CONNECTION_PARAMETER
{
const SAP_UC * name; ///< The name of the connection parameter, like ashost, user, client.
const SAP_UC * value; ///< The value of the given parameter.
}RFC_CONNECTION_PARAMETER,*P_RFC_CONNECTION_PARAMETER;
/** \struct _RFC_FIELD_DESC
* \ingroup repository
*
* Structure for reading (RfcGetFieldDescByIndex() or RfcGetFieldDescByName())
* or defining (RfcAddTypeField()) the properties of a field in a structure/table.
*/
typedef struct _RFC_FIELD_DESC
{
RFC_ABAP_NAME name; ///< Field name, null-terminated string
RFCTYPE type; ///< Field data type
/*SAPUNICODEOK_MIXEDLEN*/
unsigned nucLength; ///< Field length in bytes in a 1-byte-per-SAP_CHAR system
/*SAPUNICODEOK_MIXEDLEN*/
unsigned nucOffset; ///< Field offset in bytes in a 1-byte-per-SAP_CHAR system
/*SAPUNICODEOK_MIXEDLEN*/
unsigned ucLength; ///< Field length in bytes in a 2-byte-per-SAP_CHAR system
/*SAPUNICODEOK_MIXEDLEN*/
unsigned ucOffset; ///< Field offset in bytes in a 2-byte-per-SAP_CHAR system
unsigned decimals; ///< If the field is of type "packed number" (BCD), this member gives the number of decimals.
RFC_TYPE_DESC_HANDLE typeDescHandle; ///< Pointer to an RFC_STRUCTURE_DESC structure for the nested sub-type if the type field is RFCTYPE_STRUCTURE or RFCTYPE_TABLE */
void* extendedDescription; ///< Not used by the NW RFC library. This parameter can be used by applications that want to store additional information in the repository (like F4 help values, e.g.).
}RFC_FIELD_DESC,*P_RFC_FIELD_DESC;
/** \enum _RFC_DIRECTION
* \ingroup repository
*
* Used in #RFC_PARAMETER_DESC::direction for specifying the direction of a function module parameter.
*/
typedef enum _RFC_DIRECTION
{
RFC_IMPORT = 0x01, ///< Import parameter. This corresponds to ABAP IMPORTING parameter.
RFC_EXPORT = 0x02, ///< Export parameter. This corresponds to ABAP EXPORTING parameter.
RFC_CHANGING = RFC_IMPORT | RFC_EXPORT, ///< Import and export parameter. This corresponds to ABAP CHANGING parameter.
RFC_TABLES = 0x04 | RFC_CHANGING ///< Table parameter. This corresponds to ABAP TABLES parameter.
}RFC_DIRECTION;
/** \struct _RFC_PARAMETER_DESC
* \ingroup repository
*
* Structure for reading (RfcGetParameterDescByIndex() or RfcGetParameterDescByName())
* or defining (RfcAddParameter()) the properties of a parameter in a function module.
*/
typedef struct _RFC_PARAMETER_DESC
{
RFC_ABAP_NAME name; ///< Parameter name, null-terminated string
RFCTYPE type; ///< Parameter data type
RFC_DIRECTION direction; ///< Specifies whether the parameter is an input, output or bi-directional parameter
unsigned nucLength; ///< Parameter length in bytes in a 1-byte-per-SAP_CHAR system
unsigned ucLength; ///< Parameter length in bytes in a 2-byte-per-SAP_CHAR system
unsigned decimals; ///< Gives the number of decimals in case of a packed number (BCD)
RFC_TYPE_DESC_HANDLE typeDescHandle; ///< Handle to the structure definition in case this parameter is a structure or table
RFC_PARAMETER_DEFVALUE defaultValue; ///< Default value as defined in SE37
RFC_PARAMETER_TEXT parameterText; ///< Description text of the parameter as defined in SE37. Null-terminated string.
RFC_BYTE optional; ///< Specifies whether this parameter is defined as optional in SE37. 1 is optional, 0 non-optional
void* extendedDescription; ///< This field can be used by the application programmer (i.e. you) to store arbitrary extra information.
}RFC_PARAMETER_DESC,*P_RFC_PARAMETER_DESC;
/** \struct _RFC_EXCEPTION_DESC
* \ingroup repository
*
* Structure for reading (RfcGetExceptionDescByIndex() or RfcGetExceptionDescByName())
* or defining (RfcAddException()) the properties of an exception key in a function module.
*/
typedef struct _RFC_EXCEPTION_DESC
{
SAP_UC key[128]; ///< Exception key
SAP_UC message[512]; ///< Error message (exception text as defined in SE37)
} RFC_EXCEPTION_DESC, *P__RFC_EXCEPTION_DESC;
/** \enum _RFC_CLASS_ATTRIBUTE_TYPE
* \ingroup repository
*
* Determines the type of an ABAP Object attribute.
*/
typedef enum _RFC_CLASS_ATTRIBUTE_TYPE {
RFC_CLASS_ATTRIBUTE_INSTANCE, ///< Instance attribute (object member)
RFC_CLASS_ATTRIBUTE_CLASS, ///< Class attribute (global)
RFC_CLASS_ATTRIBUTE_CONSTANT ///< A constant
} RFC_CLASS_ATTRIBUTE_TYPE;
typedef RFC_CHAR RFC_CLASS_ATTRIBUTE_DEFVALUE[30+1]; ///< Default value of a function module parameter. (null-terminated)
typedef RFC_CHAR RFC_CLASS_NAME[30+1]; ///< Default value of a function module parameter. (null-terminated)
typedef RFC_CHAR RFC_CLASS_ATTRIBUTE_DESCRIPTION[511+1]; ///< Default value of a function module parameter. (null-terminated)
/** \struct _RFC_CLASS_ATTRIBUTE_DESC
* \ingroup repository
*
* Structure for reading (RfcGetParameterDescByIndex() or RfcGetParameterDescByName())
* or defining (RfcAddParameter()) the properties of a parameter in a function module.
*/
typedef struct _RFC_CLASS_ATTRIBUTE_DESC
{
RFC_ABAP_NAME name; ///< Attribute name, null-terminated string
RFCTYPE type; ///< Attribute data type
unsigned nucLength; ///< Attribute length in bytes in a 1-byte-per-SAP_CHAR system
unsigned ucLength; ///< Attribute length in bytes in a 2-byte-per-SAP_CHAR system
unsigned decimals; ///< Gives the number of decimals in case this attribute is a packed number (BCD)
RFC_TYPE_DESC_HANDLE typeDescHandle; ///< Handle to the structure definition in case this attribute is a structure or table
RFC_CLASS_ATTRIBUTE_DEFVALUE defaultValue; ///< Default value as defined in SE37
RFC_CLASS_NAME declaringClass; ///< Declaring class
RFC_CLASS_ATTRIBUTE_DESCRIPTION description; ///< Attribute description, null terminated, may be null
unsigned isReadOnly; ///< This attribute is read only if isReadOnly != 0
RFC_CLASS_ATTRIBUTE_TYPE attributeType; ///< The attribute type tells you, whether this attribute is an instance attribute, a class attribute or a constant.
void* extendedDescription; ///< This field can be used by the application programmer (i.e. you) to store arbitrary extra information.
}RFC_CLASS_ATTRIBUTE_DESC,*P_RFC_CLASS_ATTRIBUTE_DESC;
#ifdef __cplusplus
extern "C"
{
#endif
typedef RFC_RC (SAP_API* RFC_SERVER_FUNCTION)(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo);
typedef RFC_RC (SAP_API* RFC_ON_CHECK_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid);
typedef RFC_RC (SAP_API* RFC_ON_COMMIT_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid);
typedef RFC_RC (SAP_API* RFC_ON_ROLLBACK_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid);
typedef RFC_RC (SAP_API* RFC_ON_CONFIRM_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid);
typedef RFC_RC (SAP_API* RFC_FUNC_DESC_CALLBACK)(SAP_UC const *functionName, RFC_ATTRIBUTES rfcAttributes, RFC_FUNCTION_DESC_HANDLE *funcDescHandle);
typedef RFC_RC (SAP_API* RFC_PM_CALLBACK)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *functionName, SAP_RAW *eppBuffer, size_t eppBufferSize, size_t *eppLength);
typedef RFC_RC (SAP_API* RFC_ON_CHECK_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier);
typedef RFC_RC (SAP_API* RFC_ON_COMMIT_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier);
typedef RFC_RC (SAP_API* RFC_ON_ROLLBACK_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier);
typedef RFC_RC (SAP_API* RFC_ON_CONFIRM_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier);
typedef RFC_RC (SAP_API* RFC_ON_GET_UNIT_STATE)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier, RFC_UNIT_STATE* unitState);
typedef RFC_RC (SAP_API* RFC_ON_PASSWORD_CHANGE)(SAP_UC const *sysId, SAP_UC const *user, SAP_UC const *client,
SAP_UC *password, unsigned passwordLength,
SAP_UC *newPassword, unsigned newPasswordLength,
RFC_ERROR_INFO* cause);
typedef RFC_RC (SAP_API* RFC_ON_AUTHORIZATION_CHECK)(RFC_CONNECTION_HANDLE rfcHandle, RFC_SECURITY_ATTRIBUTES *secAttributes, RFC_ERROR_INFO* errorInfo);
typedef RFC_RC (SAP_API* RFC_ON_AUTHENTICATION_CHECK)(RFC_ATTRIBUTES rfcAttributes, RFC_AUTHENTICATION_HANDLE authenticationHandle, RFC_ERROR_INFO* errorInfo);
/* ***********************************************************************/
/* */
/* General API & Utilities */
/* */
/* ***********************************************************************/
/**
* \brief Initialization of internal variables
* \ingroup general
*
* Obsolete.
* %RfcInit() no longer needs to be called explicitly. The RFC library does
* this automatically on DLL load.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcInit(void);
/**
* \brief Get information about currently loaded sapnwrfc library.
* \ingroup general
*
* Fills the provided unsigneds with the SAP release values, e.g. *majorVersion = 7500,
* *minorVersion = 0, *patchLevel = 44.
* \out *majorVersion
* \out *minorVersion
* \out *patchLevel
* \return Version information in string format.
* \warning Don't free the returned SAP_UC pointer, it's static memory...
*/
DECL_EXP const SAP_UC* SAP_API RfcGetVersion(unsigned* majorVersion, unsigned* minorVersion, unsigned* patchLevel);
/**
* \brief This function is intended to be used by SAP Make-factory only. Please DO NOT use it!
* \ingroup general
*/
DECL_EXP RFC_RC SAP_API RfcGetVersionInternal(void);
/**
* \brief Sets the directory in which to search for the sapnwrfc.ini file.
* \ingroup general
*
* By default the sapnwrfc library searches for the sapnwrfc.ini in the current
* working directory of the process. If you want to keep it in a different directory,
* use this function to tell the sapnwrfc library about the new path.
* \note After you have changed the directory, the NW RFC lib automatically loads
* the contents of the new sapnwrfc.ini file from that directory.
*
* \in *pathName The full (absolute) path of the directory, in which the sapnwrfc
* library should look for the sapnwrfc.ini file. A path relative to the current
* working directory of the process also works.
* \out *errorInfo Detail information in case anything goes wrong.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetIniPath(const SAP_UC* pathName, RFC_ERROR_INFO* errorInfo);
/**
* \brief Loads the contents of the sapnwrfc.ini file into memory.
* \ingroup general
*
* Searches the directory given by RfcSetIniPath() (or the current working directory)
* for the file sapnwrfc.ini and loads its contents into memory.
*
* \out *errorInfo Detail information in case anything goes wrong. Note: if a file
* with the name sapnwrfc.ini does not exist in the given directory, this is not
* considered an error! Default settings are used in this case.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcReloadIniFile(RFC_ERROR_INFO* errorInfo);
/**
* \brief Sets the current trace level of the specified RFC connection or destination to the new value.
* \ingroup general
*
* \note If both of connection and destination are NULL, this function sets the "global"
* trace level. See below.
* \in connection A handle to a currently open RFC connection (client or server connection).
* The new trace level will be effective immediately.
* \in *destination Null-terminated string specifying a client or server destination as defined
* via a DEST=... entry in sapnwrfc.ini. The new trace level will be used for new connections
* to that destination opened after the %RfcSetTraceLevel() call. Already existing connections to
* that destination will not be effected.
* \in traceLevel The new trace level. Must be between 0 and 4. The meaning of those four values
* is as follows:
* - 0: Off. Only severe errors are logged to the dev_rfc.trc file.
* - 1: Brief. All API calls (except for the setter and getter functions) and important attributes
* like codepages, RFC headers, logon parameters are traced. Trace is written to a file named
* rfc<pid>.trc or rfc<pid>_<tid>.trc, depending on whether tracing is done
* on a "per-process" basis or a "per-thread" basis. <pid> is the current process ID,
* <tid> the current thread ID.
* - 2: Verbose. In addition to 1, the values of the "scalar" RFC parameters as well as the contents
* of the network containers are traced. Scalar parameters are primitive types (CHAR, INT, FLOAT, etc)
* and flat structures.
* - 3: Detailed. In addition to 2 the contents of nested structures and tables and hexdumps
* - 4: Full. In addition to 3 all API calls of setter and getter functions and table operations
* are traced.
* \out *errorInfo Detail information in case the specified connection or destination does not exist.
* \return RFC_OK, RFC_INVALID_HANDLE or RFC_INVALID_PARAMETER
*
* \note In general RFC trace can be activated/deactivated in 6 different ways:
* - By setting the parameter RFC_TRACE=[0|1|2|3|4] in the DEFAULT section of the sapnwrfc.ini file.
* This value applies to all destinations, for which no explicit trace level has been set.
* ("Global" trace level.)
* - By setting the parameter TRACE=[0|1|2|3|4] in a specific destination section of sapnwrfc.ini.
* it applies to that destination only and overrules the "global" trace level from the DEFAULT section.
* - By setting the environment variable RFC_TRACE=[0|1|2|3|4]. This overrules the setting from the
* DEFAULT section of sapnwrfc.ini.
* - Via %RfcSetTraceLevel(). If connection and destination are NULL, this function sets the global
* trace level and overrules the value from the DEFAULT section of sapnwrfc.ini as well as the environment
* variable RFC_TRACE. If connection is non-NULL, it sets the trace level for the current connection only,
* and if destination is non-NULL, it sets the trace level for that destination, overruling the value from
* this destination's section in the sapnwrfc.ini file.
* - By passing a {name=TRACE, value=[0|1|2|3|4]} pair in the RFC_CONNECTION_PARAMETER array used in
* RfcOpenConnection(), RfcRegisterServer() or RfcStartServer(). If that RFC_CONNECTION_PARAMETER array
* also contains a {name=DEST, value=...} pair, the trace parameter from the array overrules the value
* from this destination's sapnwrfc.ini section.
* - In case the program is a server program: by activating the trace flag for the corresponding destination
* in SM59. The trace setting on backend side is then "inherited" by the external side.
*
* \note For more information on trace settings see the sample sapnwrfc.ini file contained in the demo folder.
*/
DECL_EXP RFC_RC SAP_API RfcSetTraceLevel(RFC_CONNECTION_HANDLE connection, SAP_UC* destination, unsigned traceLevel, RFC_ERROR_INFO* errorInfo);
/**
* \brief Changes the character encoding to be used in trace files.
* \ingroup general
*
* This function has the same effect as the sapnwrfc.ini parameter RFC_TRACE_ENCODING.
* See the documentation of that parameter in the sample ini file contained in the
* /demo directory of the NW RFC SDK.
*
* \note This API call affects only new trace files that will be opened after the call.
* The character encoding of already existing trace files is not changed in order to
* prevent confusion and garbage data...
*
*
* \in *traceEncoding The new encoding. Possible values are "UTF-16", "UTF-8" and
* "DEFAULT". On Windows UTF-16 is recommended for faster performance. "DEFAULT" corresponds
* to the operating system's default character encoding, which is CP1252 or ISO-8859-1 on
* most Windows systems and UTF-8 on most Linux systems.
* \out *errorInfo Detail information in case of an invalid traceEncoding input.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetTraceEncoding(SAP_UC* traceEncoding, RFC_ERROR_INFO* errorInfo);
/**
* \brief Changes the directory where the NW RFC lib should write trace files.
* \ingroup general
*
* This function has the same effect as the sapnwrfc.ini parameter RFC_TRACE_DIR.
* See the documentation of that parameter in the sample ini file contained in the
* /demo directory of the NW RFC SDK.
*
* \note This API call affects only new trace files that will be opened after the call.
* The directory of already existing trace files is not changed in order to
* prevent confusion and garbage data...
*
*
* \in *traceDir The new directory. Can be an absolute or relative path name.
* The directory needs to exist prior to calling this API. The NW RFC lib will not
* attempt to create non-existing directories.
* \out *errorInfo Detail information in case of an invalid traceEncoding input.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetTraceDir(SAP_UC* traceDir, RFC_ERROR_INFO* errorInfo);
/**
* \brief Changes the way the NW RFC lib writes trace files.
* \ingroup general
*
* This function has the same effect as the sapnwrfc.ini parameter RFC_TRACE_TYPE.
* See the documentation of that parameter in the sample ini file contained in the
* /demo directory of the NW RFC SDK.
*
* \note This API call closes currently open trace files and then changes to
* "one file per process" or one "file per thread".
* If the NW RFC lib is already using the given trace type, it does nothing.
*
*
* \in *traceType Must be either "PROCESS" or "THREAD".
* \out *errorInfo Detail information in case of an invalid traceEncoding input.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetTraceType(SAP_UC* traceType, RFC_ERROR_INFO* errorInfo);
/**
* \brief Sets the global CPIC trace level used by the underlying CPIC libabry to write CPIC tracing information
* to the CPIC trace file cpic_<pid>.trc, where pid is the process ID of the current process. The CPIC trace file
* is located in the same directory where the RFC trace files are located.
* \ingroup general
*
* This function has the same effect as the sapnwrfc.ini parameter CPIC_TRACE_LEVEL.
* See the documentation of that parameter in the sample ini file contained in the
* /demo directory of the NW RFC SDK.
*
* \in traceLevel Must be a value between 0 to 3, where 0 turns tracing off.
* \out *errorInfo Detail information in case of an error.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetCpicTraceLevel(unsigned traceLevel, RFC_ERROR_INFO* errorInfo);
/**
* \brief Activates the CPIC keepalive
*
* \in timeout Must be a value between 10 and 3600, where 0 turns the cpic keepalive off.
* \out *errorInfo Detail information in case of an error.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetCpicKeepalive(unsigned timeout, RFC_ERROR_INFO* errorInfo);
/**
* \brief Sets the global Websocket trace level used by the underlying NI libabry to write tracing information
* to the trace file ws_rfc_<pid>.trc, where pid is the process ID of the current process. The NI trace file
* is located in the same directory where the RFC trace files are located.
* \ingroup general
*
* This function has the same effect as the sapnwrfc.ini parameter RFC_SOCKET_TRACE.
* See the documentation of that parameter in the sample ini file contained in the
* /demo directory of the NW RFC SDK.
* Nevertheless this API cannot set a trace level below the global socket trace level set by environment variable
* or the ini file.
*
* \in traceLevel Must be a value between 0 to 3, where 0 turns tracing off.
* \out *errorInfo Detail information in case of an error.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetSocketTraceLevel(unsigned traceLevel, RFC_ERROR_INFO* errorInfo);
/**
* \brief Sets the absolute path to the sapcrypto library to enable TLS encryption via Websocket Rfc.
* \ingroup general
*
* The parameter pathToLibrary needs also to contain the name of the library.
* This function has the same effect as the sapnwrfc.ini parameter TLS_SAPCRYPTOLIB.
* This API cannot reset a new path to the library during runtime. Once set, the path is definitive.
*
* \in *pathToLibrary Absolute path to library (.so or .dll).
* \out *errorInfo Detail information in case of an error.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcLoadCryptoLibrary(const SAP_UC* const pathToLibrary, RFC_ERROR_INFO* errorInfo);
/**
* \brief Sets the global idle time interval of a Websocket server connection in seconds after which
* a keep alive Websocket ping packet is sent.
* \ingroup general
*
* This function has the same effect as the sapnwrfc.ini parameter RFC_WEBSOCKET_PING_INTERVAL.
* The default value is 300; valid values are 0 [off] and a range from 10 [ten seconds] to 86400 [one day].
*
* \in pingInterval Interval in seconds.
* \out *errorInfo Detail information in case of an error.
* \return RFC_RC
*/
DECL_EXP RFC_RC SAP_API RfcSetWebsocketPingInterval(unsigned pingInterval, RFC_ERROR_INFO* errorInfo);