(self, flags, eor=None, checkset=0, checkunset=0, ignore=0)
| 3346 | msg_flags_non_eor_indicator = 0 |
| 3347 | |
| 3348 | def checkFlags(self, flags, eor=None, checkset=0, checkunset=0, ignore=0): |
| 3349 | # Method to check the value of msg_flags returned by recvmsg[_into](). |
| 3350 | # |
| 3351 | # Checks that all bits in msg_flags_common_set attribute are |
| 3352 | # set in "flags" and all bits in msg_flags_common_unset are |
| 3353 | # unset. |
| 3354 | # |
| 3355 | # The "eor" argument specifies whether the flags should |
| 3356 | # indicate that a full record (or datagram) has been received. |
| 3357 | # If "eor" is None, no checks are done; otherwise, checks |
| 3358 | # that: |
| 3359 | # |
| 3360 | # * if "eor" is true, all bits in msg_flags_eor_indicator are |
| 3361 | # set and all bits in msg_flags_non_eor_indicator are unset |
| 3362 | # |
| 3363 | # * if "eor" is false, all bits in msg_flags_non_eor_indicator |
| 3364 | # are set and all bits in msg_flags_eor_indicator are unset |
| 3365 | # |
| 3366 | # If "checkset" and/or "checkunset" are supplied, they require |
| 3367 | # the given bits to be set or unset respectively, overriding |
| 3368 | # what the attributes require for those bits. |
| 3369 | # |
| 3370 | # If any bits are set in "ignore", they will not be checked, |
| 3371 | # regardless of the other inputs. |
| 3372 | # |
| 3373 | # Will raise Exception if the inputs require a bit to be both |
| 3374 | # set and unset, and it is not ignored. |
| 3375 | |
| 3376 | defaultset = self.msg_flags_common_set |
| 3377 | defaultunset = self.msg_flags_common_unset |
| 3378 | |
| 3379 | if eor: |
| 3380 | defaultset |= self.msg_flags_eor_indicator |
| 3381 | defaultunset |= self.msg_flags_non_eor_indicator |
| 3382 | elif eor is not None: |
| 3383 | defaultset |= self.msg_flags_non_eor_indicator |
| 3384 | defaultunset |= self.msg_flags_eor_indicator |
| 3385 | |
| 3386 | # Function arguments override defaults |
| 3387 | defaultset &= ~checkunset |
| 3388 | defaultunset &= ~checkset |
| 3389 | |
| 3390 | # Merge arguments with remaining defaults, and check for conflicts |
| 3391 | checkset |= defaultset |
| 3392 | checkunset |= defaultunset |
| 3393 | inboth = checkset & checkunset & ~ignore |
| 3394 | if inboth: |
| 3395 | raise Exception("contradictory set, unset requirements for flags " |
| 3396 | "{0:#x}".format(inboth)) |
| 3397 | |
| 3398 | # Compare with given msg_flags value |
| 3399 | mask = (checkset | checkunset) & ~ignore |
| 3400 | self.assertEqual(flags & mask, checkset & mask) |
| 3401 | |
| 3402 | |
| 3403 | class RecvmsgIntoMixin(SendrecvmsgBase): |
no test coverage detected