| 1 | /* ssapexpd.c - SPM: write expedited data */ |
| 2 | |
| 3 | #ifndef lint |
| 4 | static char *rcsid = "$Header: /f/osi/ssap/RCS/ssapexpd.c,v 7.1 91/02/22 09:45:47 mrose Interim $"; |
| 5 | #endif |
| 6 | |
| 7 | /* |
| 8 | * $Header: /f/osi/ssap/RCS/ssapexpd.c,v 7.1 91/02/22 09:45:47 mrose Interim $ |
| 9 | * |
| 10 | * |
| 11 | * $Log: ssapexpd.c,v $ |
| 12 | * Revision 7.1 91/02/22 09:45:47 mrose |
| 13 | * Interim 6.8 |
| 14 | * |
| 15 | * Revision 7.0 89/11/23 22:25:27 mrose |
| 16 | * Release 6.0 |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * NOTICE |
| 22 | * |
| 23 | * Acquisition, use, and distribution of this module and related |
| 24 | * materials are subject to the restrictions of a license agreement. |
| 25 | * Consult the Preface in the User's Manual for the full terms of |
| 26 | * this agreement. |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | |
| 31 | /* LINTLIBRARY */ |
| 32 | |
| 33 | #include <stdio.h> |
| 34 | #include <signal.h> |
| 35 | #include "spkt.h" |
| 36 | |
| 37 | /* \f S-EXPEDITED-DATA.REQUEST */ |
| 38 | |
| 39 | int SExpdRequest (sd, data, cc, si) |
| 40 | int sd; |
| 41 | char *data; |
| 42 | int cc; |
| 43 | struct SSAPindication *si; |
| 44 | { |
| 45 | SBV smask; |
| 46 | int result; |
| 47 | register struct ssapblk *sb; |
| 48 | |
| 49 | missingP (data); |
| 50 | if (cc > SX_EXSIZE) |
| 51 | return ssaplose (si, SC_PARAMETER, NULLCP, |
| 52 | "too much expedited user data, %d octets", cc); |
| 53 | missingP (si); |
| 54 | |
| 55 | smask = sigioblock (); |
| 56 | |
| 57 | ssapPsig (sb, sd); |
| 58 | |
| 59 | result = SExpdRequestAux (sb, data, cc, si); |
| 60 | |
| 61 | (void) sigiomask (smask); |
| 62 | |
| 63 | return result; |
| 64 | } |
| 65 | |
| 66 | /* \f */ |
| 67 | |
| 68 | static int SExpdRequestAux (sb, data, cc, si) |
| 69 | register struct ssapblk *sb; |
| 70 | char *data; |
| 71 | int cc; |
| 72 | struct SSAPindication *si; |
| 73 | { |
| 74 | int result; |
| 75 | register struct ssapkt *s; |
| 76 | |
| 77 | if (!(sb -> sb_requirements & SR_EXPEDITED)) |
| 78 | return ssaplose (si, SC_OPERATION, NULLCP, |
| 79 | "expedited data service unavailable"); |
| 80 | |
| 81 | if ((s = newspkt (SPDU_EX)) == NULL) |
| 82 | return ssaplose (si, SC_CONGEST, NULLCP, "out of memory"); |
| 83 | |
| 84 | s -> s_udata = data, s -> s_ulen = cc; |
| 85 | result = spkt2sd (s, sb -> sb_fd, 1, si); |
| 86 | s -> s_udata = NULL, s -> s_ulen = 0; |
| 87 | |
| 88 | freespkt (s); |
| 89 | |
| 90 | if (result == NOTOK) |
| 91 | freesblk (sb); |
| 92 | |
| 93 | return result; |
| 94 | } |